Forum Moderators: phranque

Message Too Old, No Replies

Apache redirects from non-ending slash to ending slash with dash

         

JAB Creations

9:27 pm on Nov 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For some reason Apache is redirecting URL's without ending slashes to URL's ending with slashes though only if there is a dash in the URL without the ending slash. To make sure it was Apache I had PHP die() at the very first line and then tested my site without a slash on the same page both for 200 and 404 situations so I'm 99.9% it's Apache not liking the dash in the URL. I'd like to keep the dash versus using underscores as I remember a thread here on this site that emphasized Google prefers dashes over underscores.

In example a URL that shouldn't redirect would be...
/computers/socket-939

...which keeps redirecting to...
/computers/socket-939/

Removing the slash stops the redirect though it's not a single word...
/computers/socket939

Here is the slimmed down script that I'm using with the exact same reproducible results, thoughts please?

- John

RewriteEngine on
RewriteRule ^(test1\.php|exampledir/) - [L]
RewriteRule !\.(css|cur|zip)$ index.php

jdMorgan

11:20 pm on Nov 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Disable any of these that you do not require:
MultiViews (disable using Options directive)
AcceptPathInfo
DirectorySlashes

Except as noted for MultiViews, all of these are directive names which can be looked up in Apache's list of directive documentation if more info is needed.

Jim