apache tutorial - Rewrite Engine - apache - apache web server - apache server - apache2



Rewrite Engine in Apache

The RewriteEngine module within Apache is used to dynamically rewrite URLs and paths depending on various expressions provided:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [END]
</IfModule>
click below button to copy the code. By Apache tutorial team

The above rules will rewrite PHP files to no longer show their extension, and so that index.php will just show as a naked domain (similar to the behavior normally seen in index.html). The above rule ships with WordPress.

Note that in Apache httpd 2.2.16 and later, this entire block can be replaced with a single line using the FallbackResource directive:

FallbackResource /index.php
click below button to copy the code. By Apache tutorial team

Related Searches to Rewrite Engine in Apache