[Wylug-help] Apache .htaccess file.
Smylers
Smylers at stripey.com
Fri Oct 16 20:07:45 UTC 2009
Douglas G Mckendrick writes:
> Hi all, I'm wanting to stop http://example.com from showing up on my web
> page, and have all links point to http://www.example.com
>
> So I downloaded below code from google, edited it with my domain, then
> just copy and pasted it into .htaccess file. But it doesn't seem to be
> working, any advice? Cheers
>
> # For sites running on a port other than 80
> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteCond %{SERVER_PORT} !^80$
> RewriteRule ^/(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R]
Are you running on a non-standard port?
> # And for a site running on port 80
> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteRule ^/(.*) http://www.example.com/$1 [L,R]
Try putting this line before all the above:
RewriteEngine on
If that doesn't work then mail again, and we'll do some proper
diagnosing.
Smylers
--
http://twitter.com/Smylers2
More information about the Wylug-help
mailing list