V
V
Volgarastraport2017-01-11 07:53:56
CMS
Volgarastraport, 2017-01-11 07:53:56

.htaccess - how to redirect to a subdomain and retain access to certain files?

For example, there is a domain - mydomain.com
And there is an old site on the 3rd level domain site.mydomain.com
You need to make a redirect from the main domain to this site, which is safe from the point of view of indexing by search engines.
But while maintaining access to a bunch of different files like mydomain.com/xml/configs.xml

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2017-01-11
@Volgarastraport

use the right conditions in the RewriteCond, like this:

# если не файл
RewriteCond %{REQUEST_FILENAME} !-f
# делаем редирект
RewriteRule ^(.*)$ http://site.mydomain.com/$1 [L,QSA,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question