| Author |
Message |
stanzakh
Joined: 11 Jan 2011
Posts: 2
|
| Posted: Tue Jan 11, 2011 9: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. |
|
| Back to top |
|
drpks
Joined: 20 Dec 2010
Posts: 55
|
| Posted: Tue Jan 11, 2011 10: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>
|
|
| Back to top |
|
stanzakh
Joined: 11 Jan 2011
Posts: 2
|
| Posted: Wed Jan 12, 2011 12:41 am Post subject: |
|
|
| Haha thanks! That did the trick. |
|
| Back to top |
|
| |