Quantcast
Channel: Eureka! » Apache
Viewing all articles
Browse latest Browse all 12

Apache – Redirect non-www to www Subdomain

$
0
0

Redirecting non-www to www url can be simply done by adding a virtual host configuration. For example, if i have a domain ykyuen.com and i want to redirect it to http://www.ykyuen.com, just add the following virtual host.

<VirtualHost *:80>
  ServerAlias ykyuen.com
  RedirectMatch permanent ^/(.*) http://www.ykyuen.com/$1
</VirtualHost>

 

Restart the Apache and it should work.

Done =)

Reference: StackOverflow – apache redirect from non www to www

http://stackoverflow.com/questions/1100343/apache-redirect-from-non-www-to-www


Filed under: Apache Tagged: Apache, Postaday2011, VirtualHost

Viewing all articles
Browse latest Browse all 12

Trending Articles