.htaccess php handler mod_rewrite


/ Published in: Apache
Save to your folder(s)

This is an .htaccess file for a mod_rewrite php url handler.


Copy this code and paste it in your HTML
  1. #Disables listing of files in directorys
  2. IndexIgnore *
  3.  
  4. #Turns mod_rewrite on
  5. RewriteEngine On
  6.  
  7. #If directory exists ignore RewriteRule
  8. RewriteCond %{REQUEST_FILENAME} !-d
  9.  
  10. #If file exists ignore RewriteRule
  11. RewriteCond %{REQUEST_FILENAME} !-f
  12.  
  13. #If link exists ignore RewriteRule
  14. RewriteCond %{REQUEST_FILENAME} !-l
  15.  
  16. #Rewrite url and pass to variable $url(in php script use $_REQUEST['url']
  17. #then write url handler to parse url in index.php)
  18. RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.