Remove trailing slash using redirect directive in vhost
- by Choy
I have an issue where urls that end in a "/" after a file name causes css/js to break.
I.e., http://www.mysite.com/index.php/ <-- breaks
http://www.mysite.com/ <-- OK, only breaks for file names
To fix, I tried adding a Redirect 301 directive in the vhost file as such where I'm checking to see if there's an extension with a slash after it:
<VirtualHost *:80>
ServerName mysite.com
Redirect 301 ^(.*?\..+)/$ http://mysite.com/$1
</VirtualHost>
The redirect appears to do nothing. Is this an issue with my implementation or is what I'm trying to accomplish not possible with a Redirect 301 in the vhost file?