tags:

views:

290

answers:

2

I have searched through the related mod_rewrite qustions but I can't anything specific enough so I'll post:

Heres my rule that adds a trailing slash:

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

Only I want to exclude one specific directory eg. /mydirectoryname/ and not add the trailing slash to anything that starts with that. Reason being its breaking some of my ajax calls.

+1  A: 

Add another RewriteCond:

RewriteCond %{REQUEST_URI} !/mydicrectoryname)/

Ben Fransen
Thanks I slightly varied it but it helped :) RewriteCond %{REQUEST_URI} !(^/mydirectoryname/.*$)
Pickledegg
Okay, you're welcome! :)
Ben Fransen
+1  A: 

You can descibe that with just one condition:

RewriteCond $0 !^mydirectoryname(/|$)
RewriteRule ^[^\.]+[^/]$ /$0/ [R=301,L]
Gumbo