Welcome to WebmasterWorld Guest from 54.242.83.92

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

URL redirection with environmental variable

     
12:00 pm on Jun 6, 2013 (gmt 0)

New User

joined:June 6, 2013
posts: 1
votes: 0


I want to do a redirection in Apache2 web server with the below way:

When I type the URL : ""http://sub.mydomain.com"" in the browser, It should get redirected to ""http://localhost:8080/?var=varvalue""

I am new to apache2 server configuration and appreciate your help with the details of files and tips to be updated.

Thanks in advance.

Regards
Senthil
1:57 pm on June 11, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12537
votes: 0


Welcome to WebmasterWorld, wssen.

The Apache documentation is going to be one of your first, and most valuable, resources. However, if you get stuck after your initial attempt, the forum here at WebmasterWorld is full of amazing and talented members willing to assist.

[httpd.apache.org...]
2:18 pm on June 11, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10550
votes: 10


welcome to WebmasterWorld, Senthil!


what version of apache are you using?
this may sometimes affect the precise solution so make sure you refer to the correct documentation for your version.

you will need to use the mod_rewrite module for this.
you can test the hostname using a RewriteCond directive with %{HTTP_HOST} as the TestString.
then you can use the environment variable in the Substitution string of the RewriteRule directive by doing something like this in your target's query string:
...?var=%{ENV:EnvironmentVariableName}
7:31 pm on June 11, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:12990
votes: 287


That's assuming you really meant "environmental variable" and not simply "query string". This is far from the first time a topic header points in a different direction than the post body :)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members