Posted By

nikefido on 03/25/11


Tagged


Versions (?)

htaccess redirect all pages to index page


 / Published in: PHP
 

Redirects all requests to the index page, unless the file is an asset (css, javascript, image, etc). All directories (real or fake) get redirected to the index page. Note the file extensions (js|css|gif|jpg|jpeg|png|ico|swf|pdf) can be added and subtracted too, depending on your needs.

  1. RewriteEngine on
  2. RewriteCond %{REQUEST_FILENAME} !\.(js|css|gif|jpg|jpeg|png|ico|swf|pdf)$
  3. RewriteCond %{REQUEST_URI} !=/
  4. RewriteRule ^(.*)$ / [L,R=301]

Report this snippet  

You need to login to post a comment.