How to set correctly .htaccess for routing?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
35 views
Been trying for days to configure correctly .htaccess but not impossible to implement what you 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 as site.com/article

RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) /index.php?$1 [QSA,L]
by | 35 views

2 Answers

0 like 0 dislike
this is the most simple redirects. examples of the cloud.
by
0 like 0 dislike
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

PHP Routing Library
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 2, 2019 by Sc0undRel
0 like 0 dislike
2 answers
asked May 21, 2019 by freshik312
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users