i am trying to implement pretty url.
Everything i have written in PHP and it works properly. I need to handle every request by index.php.
For example website.com/page/search/question/dogs will be handled by index.
BUT website.com/templates/header.tpl will start downloading the file.
I want to handle by index.php even adress to another file.
In .htaccess i have.
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
How can i hande even absolute url to file by index.php?
If you want to rewrite URLs for files that exist on the server already, you need to drop the
!-F(not a file) and the!-D(not a directory) check. Otherwise you’ve setup the wrongRewriteConditions for yourRewriteRule.However, there is one caveat, you don’t want to rewrite for
index.phpitself, otherwise it would result in an endless rewrite-loop.See as well
RewriteCondDirectiveDocs.