K
K
Konstantin2015-01-26 09:06:35
htaccess
Konstantin, 2015-01-26 09:06:35

How to redirect via .htaccess by mask?

Good afternoon. Help, please, to solve 2 problems.
1. There are pages like domen.ru/ ?p=168 , domen.ru/ ?p=169 , etc. I need to redirect from such page to the main page.
2. It is necessary to close the indexing of all similar pages like domen.ru/ ?p=168 from search engines

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-02-25
@itrigger

These are not pages, but get requests, they have nothing to do with pages.
Get request redirects are different from regular URL redirects.
Geth are not urls, from the point of view of the Apaches they are just geth.

RewriteCond %{QUERY_STRING} (^|&)p=[0-9][0-9][0-9]($|&)
RewriteRule ^domen\.ru/$ /domen.ru/? [L,R=301]

Since there are only 3 digits in your getas, I made a regular expression for them, if necessary, correct them
for the required condition.
Also don't forget to escape the dot in the domain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question