PDA

View Full Version : Automatically adding the www in the URL?


BadFurDay
03-18-2010, 10:25 PM
Hi,

I've searched a bit, but due to the search terms being completely generic, couldn't find anything worthy.

I'm looking for a way to add the www. in my forum's URLs when it's not in (eg. when people type http://mysite.com/forum, it'd redirect them to http://www.mysite.com/forum), for the simple reason that not having it in completely screws up a few hacks I use.


Anyone has a functional way to easily do this? Thanks in advance!

TimberFloorAu
03-19-2010, 01:03 AM
htaccess

add

# force www in url
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# END force www in url

BadFurDay
03-19-2010, 07:59 AM
htaccess

add


# force www in url
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# END force www in url


Works, thank you very much :)

TimberFloorAu
03-19-2010, 08:52 AM
Very Welcome