Posted By

mattkenefick on 04/27/10


Tagged

slashes htaccess


Versions (?)

Remove Trailing Slashes, Force Index


 / Published in: Apache
 

Removes trailing slashes from URLs, forces all urls to index.php

  1. RewriteCond %{http_host} ^MyExample.com [nc]
  2. RewriteRule ^(.*)$ http://www.MyExample.com/$1 [r=301,nc,L]
  3.  
  4. RewriteBase /
  5.  
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteRule ^(.+)/$ /$1 [R=301,L]
  8.  
  9. RewriteCond %{REQUEST_FILENAME} !-f
  10. RewriteCond %{REQUEST_FILENAME} !-d
  11. RewriteRule . /index.php [L]

Report this snippet  

You need to login to post a comment.