Welcome to WebmasterWorld Guest from 54.167.175.107

Forum Moderators: Ocean10000 & incrediBILL & phranque

URL redirection with environmental variable

   
12:00 pm on Jun 6, 2013 (gmt 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 Jun 11, 2013 (gmt 0)

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



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 Jun 11, 2013 (gmt 0)

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



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 Jun 11, 2013 (gmt 0)

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



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 :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month