Rewrite Module/Rewrite URL/Virtual File

No Comments

This functions would help you to redirect a virtual page to a PHP script file.

Please add the below code lines into your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /PATH_TO_YOUR_ROOT
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /PATH_TO_YOUR_FILE/YOUR_FILE_SCRIPT [L]
</IfModule>

For example:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Leave a Reply