PDA

View Full Version : mod_rewrite



rubah
03-18-2007, 08:44 PM
RewriteRule http://snowy-day.net http://www.snowy-day.net/ [R=301]
RewriteRule http://snowy-day.net/(.*)? http://www.snowy-day.net/($1) [R=301]

My goal is to force the www. on all URLs on my site and the trailing slash on the domain level. This is obviously not a good way to do it, nor a correct one, as it doesn't work. What do I do instead?

More questions to follow at some point if I get to the point where I have some terribly ugly php-made urls.

Baloki
03-19-2007, 02:11 PM
I'd probably use some If Statements pulled in with a PHPInclude that force each page to check and alter the url?

rubah
03-19-2007, 10:12 PM
Jason showed me the light:

RewriteCond %{HTTP_HOST} ^snowy-day.net [NC]
RewriteRule ^(.*)$ http://www.snowy-day.net/$1 [R=301]