punk_runner Posted February 20, 2011 Share Posted February 20, 2011 I currently redirect all non-file, non-directory HTTP requests to the front controller of my MVC framework with this bit of mod-rewrite: <IfModule mod_rewrite.c> RewriteEngine on # if there's only one URL bit, load it as a file # this is for things like login.php, contact.php etc. RewriteRule ^([^/]+)/$ $1.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # route all remaining URL's to the front controller RewriteRule .* index.php [L] </IfModule> However, I need to add a trailing slash to my URLs. Since the typical way to add a trailing slash is to use a 301 redirect to the URI with the slash concatenated, it conflicts with my redirect to the front controller (you can only redirect once)... Any ideas on how I can add the slash before it is redirected, so that the URI carries forward to the front controller with the trailing slash in tact? Not having the trailing slash is screwing with my breadcrumb class further down the code road... Quote Link to comment https://forums.phpfreaks.com/topic/228250-add-trailing-slash-w-front-controller-redirect/ Share on other sites More sharing options...
punk_runner Posted February 22, 2011 Author Share Posted February 22, 2011 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/228250-add-trailing-slash-w-front-controller-redirect/#findComment-1178029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.