PDA

View Full Version : .htaccess add www EXCEPT to url.com/folder


croatiankid
09-24-2006, 10:41 PM
hi, i'd like a .htaccess script that will, when a user types in myurl.com, bring him to www.myurl.com, EXCEPT if he types myurl.com/blog or www.myurl.com/blog. the reason for the exception is that the scripts i've tried somehow effect wordpress critically (after you press submit comment, u get a blank page and the comment isn't saved, along with some other anormalities). thanks

schleppel
09-24-2006, 11:25 PM
Try the following mod_rewrite:
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\.url\.com$ [NC]
RewriteRule !^blog(/.*)?$ http://www.url.com%{REQUEST_URI} [R=301,L]

croatiankid
09-25-2006, 09:32 AM
thanks, that did the trick!