Reputation: 1
My Working URL: http://www.mydomain.com/user/
Broken URL: http://www.mydomain.com/user
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ /lookup.asp?q=$1 [NC,L]
How can I modify my current code so that the url works with or without a trailing slash?
Thanks in advance.
Upvotes: 0
Views: 468
Reputation: 33904
You have to add just a ?
to your RegEx, to make the /
optional:
RewriteRule ^([^/]+)/?$ /lookup.asp?q=$1 [NC,L]
In this way, both URLs are working.
Or you could just remove the slash.
Upvotes: 1