apache - htaccess - Rewrite any URI to find a php file -


After all the .htaccess file examples of "itemprop =" text ">

that are specific to a particular page that I have seen, But there is a better way with a PHP site rewriting URL for a static PHP website

Let's assume the value of the directory structure is as follows:.

  | --- Index.php | --- contact.php | --- / products / | | --- index.php | | --- features.php | | --- Price.php  

There is a way .htaccess to write that the user goes for example.com/contact/ < , Then the code / or example.com/products/ or example.com/features/ will get pages to be typed without specifying each page as they would Are you This is to be handled in PHP

You can use that in your original .htaccess:

  Option at RewriteCond% -MultiViews RewriteEngine {REQUEST_FILENAME}! -d RewriteCond% {REQUEST_FILENAME}! -f RewriteCond% {DOCUMENT_ROOT} / $ 1 \ .php -f RewriteRule ^ (. +) /? $ $ 1.php [L]  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -