1

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*[^/])$ /$1/ [L,R=301]

When I'm using this to adding slash at the end it is redirecting like example.com//

But I want to redirect my url

 www.example.com 

to

 www.example.com/

Can any one suggest me how to do this?

1 Answer 1

0

Have you tried searching the forum?

RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]

Source: .htaccess Rewrite to Force Trailing Slash at the end

More questions:

Htaccess: add/remove trailing slash from URL

Add Trailing Slash .htaccess

.htaccess if url not ends with extension, add slash at the end

1
  • RewriteBase / RewriteCond %{index.php} !-f RewriteCond %{HTTP_HOST} !index.php RewriteCond %{HTTP_HOST} !(.*)/$ RewriteRule ^[^/]*$ http://%{HTTP_HOST}/$1/ [L,R=301] when im using this I'm getting two slashes at the end of url, but i just need only one slash, can u suggest me? May 22, 2015 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.