Forum Moderators: phranque
all the anchor text in the site completes the directories with a / at the end. (example <a href="home-decor/">...) but yahoo shows the results with out the / therefore destoying my mod rewrite pattern matching.
This is what I've got in my .htaccess
RewriteCond %{REQUEST_URI}!/db/$
RewriteCond %{REQUEST_URI}!/admin/$
RewriteCond %{REQUEST_URI}!/test_orders/$
RewriteCond %{REQUEST_URI}!/test_orders/db/$
RewriteRule ^(.*)/$ /category.php?mod_name=$1 [L]
the key is the RewriteRule ^(.*)/ <-----
I've tried to just add another rule to make up for the missing /
RewriteRule ^(.*)$ /category.php?mod_name=$1 [L]
but when I do I get a 500 error.
When users come in through these directories they are going to get a 404 error and shot right to the domain. That looks too much like a fantomaster cloak for my liking. Any help would be greatly appreaciated!
Welcome to WebmasterWorld!
Check to see if your server has mod_dir loaded.
mod_dir will append missing slashes to directory requests.
Also check to see if your server is configured with UseCanonicalName on. If so, this can cause problems if the server path is not defined with a trailing slash. Try setting UseCanonicalName off.
These checks assume that you have access to httpd.conf. If not, ask your host to look into this.
You should also exclude category.php from the rewrite, so as to avoid a rewriting loop -- mod_rewrite in .htaccess behaves recursively. Change the last three lines to:
RewriteCond %{REQUEST_URI} !/test_orders/db/$
[b]RewriteCond %{REQUEST_URI} [i][/i]!^/category\.php$[/b]
RewriteRule ^(.*)[b]/?$[/b] /category.php?mod_name=$1 [L]