K
K
Kamil2019-07-09 14:31:35
Apache HTTP Server
Kamil, 2019-07-09 14:31:35

Apache config or .htaccess, ban on entering the site via a direct link?

Hello, please tell me how to implement such a scheme. It is
necessary that when you enter the site.ru site (entering the site address into the browser line), a page for example 404 is displayed, but if you enter the site from a search engine, the main page of the site is displayed.
I've seen this on several projects.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2019-07-17
@Lakika

SetEnvIfNoCase User-Agent .*google.* search_robot
SetEnvIfNoCase User-Agent .*yahoo.* search_robot
SetEnvIfNoCase User-Agent .*bot.* search_robot
SetEnvIfNoCase User-Agent .*ask.* search_robot

Order Deny,Allow
Deny from All
Allow from env=search_robot

searched on google in a few seconds

F
FORTY YEARS, 2019-07-09
@AItF4

RewriteEngine on 
RewriteCond %{HTTP_REFERER} ^$ 
RewriteRule^- [F,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question