Forum Moderators: phranque
I'm running Drupal 5.1 and it uses URLs in the form of:
http://example.com/foo
I want to use trailing slashes such as:
http://example.com/foo/
so I used the following to 301 redirect the former to the latter:
#Ensure Trailing Slashes
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ [%{HTTP_HOST}...] [R=301,L]
However, the problem comes in when there is a query string as follows such as is required during login:
http://example.com/foo?var=value
I've tried many things but can't see to get the site to work correctly with the above in my .htaccess file. Can anyone help me make this work?
Thanks in advance.
Note that you can reattach the origional query string (if any).
The pattern for detecting URL-paths containing "." or ending in "/" has a flaw: It will not append a slash if the root page of the site is requested as, for example, "example.com". However, it is possible that mod_dir will be invoked to correct this situation.
We need a better description of what you mean by "it doesn't work."
What URLs are you requesting?
What results do you expect for each?
How do actual results differ from your expectations?
Jim