vishal.angre Posted March 9, 2013 Share Posted March 9, 2013 Hello Guys, I written code for adding trailing slash using htaccess. code as below. RewriteEngine OnOptions +FollowSymlinksRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_URI} !example.phpRewriteCond %{REQUEST_URI} !(.*)/$RewriteRule ^(.*)$ /$1/ [L,R=301]RewriteRule ^index/$ index.php This code is perfectly working xamp local server. http://www.domain.com/index/ - executes http://www.domain.com/index.php But when i upload files on live linux server. it does not work. because index.php available on server like same name not work. If i make it. RewriteRule ^home/$ index.php then it will work on server. http://www.domain.com/home/ - executes http://www.domain.com/index.php It means, the same file name exists then not work. Please help on this. what is the problem. any rewrite condition to resolve this problem. Link to comment https://forums.phpfreaks.com/topic/275431-adding-trailing-slash-using-htaccess/ Share on other sites More sharing options...
requinix Posted March 9, 2013 Share Posted March 9, 2013 Try without MultiViews too. Options +FollowSymLinks -MultiViews Link to comment https://forums.phpfreaks.com/topic/275431-adding-trailing-slash-using-htaccess/#findComment-1417699 Share on other sites More sharing options...
vishal.angre Posted March 11, 2013 Author Share Posted March 11, 2013 Thank you very much requinix.. Link to comment https://forums.phpfreaks.com/topic/275431-adding-trailing-slash-using-htaccess/#findComment-1417911 Share on other sites More sharing options...
requinix Posted March 11, 2013 Share Posted March 11, 2013 So it worked? Great. MultiViews allows you to omit extensions from existing files, so with it enabled /index will be automatically translated to index.php. By the time mod_rewrite and your RewriteRule kicks in, the request has already been "rewritten" to /index.php, the REQUEST_FILENAME !-f will not be true, and your URL rewriting will not trigger. Link to comment https://forums.phpfreaks.com/topic/275431-adding-trailing-slash-using-htaccess/#findComment-1417914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.