I’d like to work with pages without trailing slashes. So now I want my URL’s with an trailing slash to redirect (using .htaccess) to the same URL without the trailing slash.
I got two .htaccess files:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*) public/$1
</IfModule>
And one in my public folder:
DirectoryIndex index.html index.php
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
I tried adding the following rule to the .htaccess file in the public folder:
RewriteRule (.*)/$ $1 [R,L]
But then:
example.com/public/page/view/2/
Redirects to:
example.com/**D:/webserver/**public/page/view/2
Which is obviously not what I want…
Why do you have several .htaccess files? Where are the one’s redirecting to public/$1 stored? You may very well be facing overriding RewriteRule directives that complicate things for you.
Without knowing your setup it’s fairly hard to say how you should be using rewrites – can you specify what things are ACTUALLY looking like?