We Recommend

Mastering Regular Expressions Mastering Regular Expressions
As this book shows, a command of regular expressions is an invaluable skill. Regular expressions allow you to code complex and subtle text processing that you never imagined could be automated. Regular expressions can save you time and aggravation. They can be used to craft elegant solutions to a wide range of problems. Once you've mastered regular expressions, they'll become an invaluable part of your toolkit. You will wonder how you ever got by without them.


Posted By

fris on 08/29/08


Tagged

regex modrewrite apache


Versions (?)


php as html with mod_rewrite


Published in: Regular Expression 


domain.com/file.php will work as domain.com/file.html

you could do an addtype, but this is more painful and fun

  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteCond %{SCRIPT_FILENAME} !-f
  4. RewriteCond %{REQUEST_URI} ^(/.+\.)html$ [NC]
  5. RewriteCond %{DOCUMENT_ROOT}%1php -f
  6. RewriteRule \.html$ %1php [NC,QSA,L]

Report this snippet 

You need to login to post a comment.