Linode Forum
https://forum.linode.com/

Can't access my website with www
https://forum.linode.com/viewtopic.php?f=19&t=6537
Page 1 of 1

Author:  stanzakh [ Tue Jan 11, 2011 10:17 pm ]
Post subject:  Can't access my website with www

Everything seems to be working fine when I visit my site with just http://yogacarashop.com , however when I try http://www.yogacarashop.com , I'm led to a Forbidden page.

I'm running Ubuntu 10.04, and currently I've tried redirecting the www to non-www with .htaccess, but that didn't work out. I also tried modifying the apache2.conf in /etc/apache2/apache2.conf to redirect the www to non-www, but that apparently puts it in a redirection loop. I'm not really sure what to do from here.

Author:  drpks [ Tue Jan 11, 2011 11:31 pm ]
Post subject: 

You have to add ServerAlias inside apache configuration:
Code:
    ServerAdmin webmaster@yogacarashop.com
    ServerName yogacarashop.com
    ServerAlias www.yogacarashop.com


EDIT: if it doesn't work, try this .htaccess:
Code:
<IfModule mod_rewrite.c>
  RewriteEngine on

# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
</IfModule>

Author:  stanzakh [ Wed Jan 12, 2011 1:41 am ]
Post subject: 

Haha thanks! That did the trick.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/