Answer the question
In order to leave comments, you need to log in
How to create such a condition in .htaccess?
Hello. Tell me please.
How to do this, if I enter site.ru into the browser line, then I get the "blank page / white screen" page on a blank sheet of paper without dops in the domain, for example: (like page.html, etc)
If I go to the same site. ru from the search, then the site opens for me in full.
Or If I go to the same site.ru from the search, then a site with a subdomain 123.site.ru opens for me
At the same time, allow all search bots to see the main page (instead of a white sheet / screen)
Answer the question
In order to leave comments, you need to log in
An empty page can be formatted as a separate file or put the content directly into the ErrorDocument .
Search bots can be searched by the From or User-Agent HTTP headers.
ErrorDocument 403 "<!DOCTYPE html><html><head></head><body></body></html>"
RewriteEngine on
RewriteCond %{http_Referer} !^https?://(www\.)?(site\.ru|(yandex|google)\.\w+)/
RewriteCond %{http:From} !(googlebot|yandex)
RewriteRule ^ - [R=403,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question