Search code examples
apache.htaccessmod-rewriteurl-rewritingxampp

Set a file as the catch-all handler with .htaccess


This is what's in the root directory of the locally hosted web app

|- index.php
|- feed.php
|- .htaccess

I want to direct all the requests to index.php, no matter what the requested uri is. E.g., I want the server to execute index.php even if feed.php is typed into the address bar.

How should I configure the .htaccess file so that the server work as I intend it to?


Solution

  • You can put the following in your htaccess file

    RewriteEngine On
    
    RewriteRule !index\.php /index.php [NC,L]