I am creating php front controller. this is my .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) controller.php [L]
</IfModule>
This code redirect all url to the controller.php. I need to avoid redirect index.php to the controller.php. All other urls should redirect to the controller.php.
You can use the following syntax to make an exception:
The dash (
-) is important. The[L]makes sure that if this rule is triggered, it’s the last one that will be processed. So naturally, you’ll need to place it near the top of your.htaccessfile, before the rule in your question:The documentation has the following to say: