F
F
FBI_commander2018-12-02 22:57:21
htaccess
FBI_commander, 2018-12-02 22:57:21

What is the best way to configure htaccess?

Now there is a rule
RewriteRule ^(.*)$ ./index.php?page=$1
request www.site.ru/rules
in scripts is recognized as www.site.ru/index.php?page=rules
Is it possible to somehow rewrite the rule so that
www.site.ru/rules/1 requests are
recognized as www .site.ru/index.php?page=rules&i=1
www.site.ru/rules/
as
Recognized as www.site.ru/index.php?page=rules

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-12-02
@FBI_commander

RewriteRule ^(.*)$ ./index.php?page=$1

Instead, the rules are:
RewriteRule ^([^/.]+)/(\d+)$ index.php?page=$1&i=$2

RewriteRule ^([^/.]+)/?$ index.php?page=$1

Or combine into one rule:
RewriteCond page=$1&i=$2    ^(.+=[^&]+)
RewriteRule ^([^/.]+)(?:/(\d*))?$ index.php?%1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question