Answer the question
In order to leave comments, you need to log in
How to configure .htaccess for routing correctly?
I've been trying to set up .htaccess correctly for several days, but I just can't get what I want.
If the user enters:
www.site.com redirect to site.com
www.site.com redirect to site.com
site.com/article redirect to site.com/article/
There is also a problem if the user enters site.com/index.php /article also works like site.com/article
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php?$1 [QSA,L]
Answer the question
In order to leave comments, you need to log in
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
PHP Routing Library
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question