htaccess route all requests to index.php 1

htaccess route all requests to index.php

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L,QSA]


Using Sub directory:
RewriteRule ^.*$ /mvc/index.php [L,QSA]

Here is what the above code is Doing:
1. RewriteEngine on: Turns on the rewrite engine.
2. RewriteCond %{REQUEST_FILENAME} !-f: If the requested file is not a real file.
3. RewriteCond %{REQUEST_FILENAME} !-d: If the requested file is not a real directory.
4. RewriteRule ^.*$ /index.php [L,QSA]: If the above conditions are met, rewrite the URL to index.php.

Similar Posts