hi
I have inherited a project with some mod_rewrite code that I do not really undertsand. The site works fine unless a slash is missing at the end of the URL.
Most of the the .htaccess script works but it does NOT add a trailing slash at the end of my urls if it is missing and I keep getting 'page cannot be found'.
To me, the first 3 lines should add a trainling slash to the URL but it does not seem to work.
For info, the site is all DB driven and none of the URLs I try to connect do exists on the server.
I need the .htaccess to make sure there is a '/' at then of all urls
Code:
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule (.*) /$1/ [R=301,L]
RewriteCond %{REQUEST_URI} ^/main_folder/$
RewriteRule ^(.*)$ /main_folder/_base.php [L,QSA]
RewriteCond %{REQUEST_URI} ^/main_folder/assets/css/language.css$
RewriteRule ^(.*)$ /main_folder/_base.php [L,QSA]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /main_folder/_base.php [L,QSA]
_base.php is the file that processes the urls
If I change the first 3 lines with
Code:
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_URI} !(.*)\.
RewriteRule (.*) http://mydomain/main_folder/$1/ [R=301,L]
then it works within the site. But I still get a page cannot be found with 'http://mydomain/main_folder' as it is not dealt with.