I have trouble with my rewriterule during my .htaccess To start, i've got a wlidcard on my small website (*.site.com)

This is actually the path of my website :

/home/world wide web/static/

/home/world wide web/home/

/home/world wide web/.htaccess

And so i designed a .htaccess at the bottom of my website with :

RewriteCond % static.site.com [NC]

RewriteRule !^static/ static%

RewriteCond % world wide web.site.com [NC]

RewriteRule !^home/ home%

These redirects run very good however when i wish to visit for instance :

http://world wide web.site.com/img

There is a problem, it's redirecting me in http://world wide web.site.com/home/img/

However when i type http://world wide web.site.com/img/ using the final backslash things are ok.

Thank you for replies :)

Try:

RewriteRule ^(.*)$ $1/ [R=301,L]

This will add-on the missing slash for you personally whether it's missing. You would range from the 'L' flag to inform the rewrite engine that here's your LAST rewrite and never to use another rule on the top of that one.

Don't match demands which map to existing sites

RewriteCond % !-d

In the event that does not work, try matching if the request plus another slash is really a directory?

RewriteCond %/ !-d

Solved :

RewriteCond % !-f

RewriteCond % !(.[a-zA-Z0-9]/#(.*))$

RewriteRule ^(.*)$ $1/ [R=301,L]