Need help with WWW redirection in apache
How can I redirect my domain to show 'www' in front of it. For example when someone type my domain name into a browser without the www, I want the domain to automatically default to the www, when it comes up ex. So when user enter mydomain.com I want him to be redirected directly to www.mydomain.com and automaticly to see www.mydomain.com n the addressbar insted od mydomain.com. I need this to be setup in a virtual host directive in my httpd.conf file
Thanks in advance |
You wouldn't do it entirely in apache.
Step 1. Create seperate virtual host entries for both www.website.com and website.com Have website.com use a different directory. Step 2. Create an index.html page the does auto redirection. To do this put the following in the <HEAD> section. <META HTTP-EQUIV="Refresh" CONTENT="1; URL=html-redirect.html"> That should do it. |
Here are 2 site from a quick google search that explain the redirect directive in virtualhosts:
http://yost.com/computers/apache-redirect/ http://www.cgi-interactive-uk.com/ap...directive.html |
That's useful info.
|
All times are GMT -5. The time now is 02:08 PM. |