T
T
tigra2016-03-21 10:00:41
htaccess
tigra, 2016-03-21 10:00:41

How to make a substitution for another file in .htaccess?

you need to make a substitution from a file to another depending on the subdomain,
for example, if novgorod.site.ru/robots.txt then it should open novgorod.robots.txt
subdomains and the name of robots are the same

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timur Kalimullin, 2017-05-19
@ZetRider

Option?

RewriteCond %{HTTP_HOST} ^(www\.)?01pr\.ru$ [NC]
RewriteRule ^robots.txt robots.ufa.txt [L]
RewriteRule ^favicon.ico /icons/ufa/favicon.ico [L]

S
Sergey Zelensky, 2016-03-21
@SergeyZelensky-Rostov

Redirect 301  http://novgorod.site.ru/robots.txt  http://novgorod.site.ru/folder/robots.txt

V
Viktor Taran, 2016-03-21
@shambler81

The redirect to the file should work, but if you have nginx + apache, then obviously not.
You will need to write a redirect in nginx itself since file requests do not reach Apache in principle.
Try this to start.
or

RewriteRule ^robots\.txt$ /folder/robots.txt? [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question