Can anyone help me with the following .htacess problem. The contents of my .htaccess are as follows : RewriteEngine on RewriteCond $1 !^blog RewriteCond $1 ^blog RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?$ blog.php?sub_section=$2&id=$3&title=$4&ht_url=true [L] Code (markup): With the above rule, whenever someone enters the address http://www.mydomain.com/blog, it takes them to the specific blog.php page. But also, whenever someone enters something like http://www.mydomain.com/blogger or http://www.mydomain.com/blogggggggg , it takes them to the blog.php page and not the subdomain "blogger" or "blogggggg" So, when the first four letters match "blog", it takes them to the blog.php and not the subdirectory I want. What do I have to edit in the rule there to have my subdomains working? Thanks in advance.
Bit confused but is this what you want? RewriteEngine On RewriteBase / RewriteRule ^blog$ blog.php [L] RewriteRule ^([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?([^/\.]+)?/?$ blog.php?sub_section=$2&id=$3&title=$4&ht_url=true [L]
After reading some htacess mod_rewrite tutorials, I found the soluion.. "RewriteCond $1 !^blog" -> There was a missing "$" at the end. Anyways krt, thanks for your response.
What tutorial are you looking at? I consider myself fairly well versed with mod_rewrite but have never come across the $1 marker in a RewriteCond statement. Might try it myself but I think it's working only because the parser is guessing what you want to do.
Here's the tutorial link... http://corz.org/serv/tricks/htaccess2.php The thing works.. maybe its like u said.. its guessing..