RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
There’s no way for me to test this htaccess code. For example my output URL is: http://www.domain.com/index.php?mod=category, what might be the result?
It makes
index.phpoptional in URL which means if you go to:That should work fine just as well.
It is usually used by those frameworks which implement the Front Controller Pattern. With front controller design pattern, all requests of the web application are routed through
index.php, so since it is needed always, one can use above htaccess rules to hide it altogether since it is obvious.