[Wylug-help] Apache .htaccess file.

Lee Evans lee at leeevans.org
Fri Oct 16 20:12:16 UTC 2009


Try

RewriteRule ^.*$ http://www.%1.%2%{REQUEST_URI} [R=301,L]


HTH
Lee

-----Original Message-----
From: wylug-help-bounces at wylug.org.uk
[mailto:wylug-help-bounces at wylug.org.uk] On Behalf Of Douglas G Mckendrick
Sent: 16 October 2009 20:36
To: wylug-help at wylug.org.uk
Subject: [Wylug-help] Apache .htaccess file.

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

Doug

# 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]

# 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]







_______________________________________________
Wylug-help mailing list
Wylug-help at wylug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/wylug-help





More information about the Wylug-help mailing list