Q
Q
qlr2015-04-21 20:48:51
PHP
qlr, 2015-04-21 20:48:51

How to make a proper Redirect 301 with a question mark?

I don’t understand how to make a 301 redirect from this url:
www.site.ru/news?page=2 / (at the end the slash does not allow to put without a space)
to this one:
www.site.ru/news?page=2
Need a specific redirect pages (page=2), and not completely remove the slash everywhere .
Tried these options:

RewriteCond %{QUERY_STRING} ^(.*)news\?page=2
RewriteRule ^(.*)$ http://www.site.ru [R=301,L]

RewriteCond %{QUERY_STRING} ^page=2$ 
RewriteRule ^index\.php$ http://www.site.ru [L,R=301] 

RewriteCond %{QUERY_STRING} ^page=2 
RewriteRule (.*) http://www.site.ru [L,R=301]

Does not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2015-04-21
@qlr

RewriteCond %{QUERY_STRING} ^(page=2)/$
RewriteRule ^news?$ /news?%1 [L,R=301]

Sign ? does not match %{QUERY_STRING}
htaccess.madewithlove.be is a good tool for testing mod_rewrite and more

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question