homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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.




 1:57 pm on Jun 11, 2013 (gmt 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.



 2:18 pm on Jun 11, 2013 (gmt 0)

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:

 7:31 pm on Jun 11, 2013 (gmt 0)

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved