Posted By

apphp-snippets on 02/05/14


file remove htaccess extention apphp

Versions (?)

Remove File Extention from URLs in .htaccess

 / Published in: PHP


This example shows you how to remove file extension from URLs using .htaccess file directives. Remember, that "modrewrite" works only on Apache server. Before trying please be sure that you are working on Apache server and the "modrewrite" module/extension is enabled.

  1. # Sample 1:
  2. RewriteRule ^about$ about.php [L]
  4. # Sample 2:
  5. RewriteCond /%{REQUEST_FILENAME}.php -f
  6. RewriteRule ^([a-zA-Z0-9_-\s]+)/$ /$1.php

Report this snippet  

You need to login to post a comment.