Here's a redirect I have:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
The problem is if I type http://www.example.com/apple
it's OK when it comes to my links on the page.
BUT if I use http://www.example.com/apple/
(notice last slash) then links are all screwed up.
How do I write the .htaccess so links will not include the last slash and not screw up links on page?
Update: I ended up using:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R=301,L]