0
I am trying to use a. htaccess file to redirect all requests to a single file, but I am facing some problems.
My . htaccess is like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
My index.php file is in the same directory as the . htaccess file, and I also have in this same directory a 1.php page file. My problem is when I access:
localhost/page1.php
When I specify the file extension, it is processed, rather than redirecting to index.php
How could you make even with the extension the request redirect to the index.php file, without affecting CSS and JS imports?
Hint: The line
RewriteCond %{REQUEST_FILENAME} !-f
serves to verify if the file exists, if the condition is true, executes it.– Valdeir Psr