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

281 views Asked by At

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?

1

There are 1 answers

0
Amit Verma On BEST ANSWER

You can put the following in your htaccess file

RewriteEngine On

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