P
P
Petro Boyko2017-09-17 15:04:27
PHP
Petro Boyko, 2017-09-17 15:04:27

How to properly configure RewriteRule in htaccess?

Tell me how to set up a link in htaccess ,
pagination from the file does not switch, the link is displayed in the browser and the page does not switch
, you need to look like this site.ru/blog.html?page=3
so it works when you navigate through the
RewriteRule pages ^( .*).html$ index.php?alias=$1 [L]
does not switch page by page from
RewriteRule file ^(.*).html$ index.php?alias?page=$1 [L]
so
RewriteRule ^blog&page=( [0-9]*)$ index.php?alias=blog&page=$1 [L]
RewriteRule ^blog&page=(.*).html$ index.php?alias=blog&page=$1 [L]
displays site.ru/blog&page= 2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-09-18
@shambler81

If you have get parameters, then you need to select them separately

RewriteCond %{QUERY_STRING} (^|&)blog($|&)
RewriteCond %{QUERY_STRING} (^|&)page\=([0-9]{1,})($|&)
RewriteRule .............................. [L,R=301]

You can also substitute the values ​​from the rewrite cond brackets through %1 %2 and so on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question