V
V
vadimstroganov2016-01-19 14:58:51
htaccess
vadimstroganov, 2016-01-19 14:58:51

htaccess redirect without specifying php file in browser line?

Good afternoon. I can't figure out how to do a redirect.
You need to redirect links containing the GET parameter 'option' to page 404.
I do this:

RewriteCond %{QUERY_STRING} ^option=(.*)$ [NC]
RewriteRule . - [R=404,L,NC]

But, the redirect works only if the link looks like this: site.com/ index.php ?option.....
And it doesn’t work if it’s like this: site.com/?option.....
Please tell me how the links of the second kind of redirect too?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Krasnov, 2016-01-29
@OKrasnov

Try this:
RewriteCond %{QUERY_STRING} ^option=(.*)$ [NC]
RewriteRule ^(.*)$ /? [R=404,L,NC]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question