Nice URLS PHP .htaccess


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

You can combine them with this: http://snipplr.com/view/4848/underscore-strings/


Copy this code and paste it in your HTML
  1. .htaccess
  2. RewriteEngine On
  3. RewriteCond %{REQUEST_FILENAME} !-f
  4. RewriteCond %{REQUEST_FILENAME} !-d
  5. RewriteRule ^(.*)$ $1.php [L,QSA]
  6. # http://domain/about -> http://domain/about.php
  7.  
  8. --------------------------------------------------
  9.  
  10. .htaccess
  11. RewriteEngine On
  12. RewriteCond %{REQUEST_FILENAME} !-f
  13. RewriteCond %{REQUEST_FILENAME} !-d
  14. RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  15. # http://domain/about -> http://domain/index.php?q=about
  16.  
  17. <?php
  18. // $url_data is an array
  19. $url_data = explode("/",$HTTP_SERVER_VARS['PATH_INFO']);
  20. ?>

URL: http://spindrop.us/2006/07/26/how-to-remove-file-extensions-from-urls/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.