Good day. A similar question has been raised many times already, but everywhere either the same answer and it does not work. Mana smoked, Google is already broken. There is a domain site.ru The processing of subdomains is enabled. Required on request news.site.com implicitly redirect to site.com/news. Those. in the address bar should remain news.site.com. The project is written in Kohane, respectively, the news folder is not in the directory with the site. Explicit redirection works. However, I need to leave the address news.site.com without 301 code

RewriteCond %{HTTP_HOST} ^forum\.domain\.(com|ru)$ RewriteCond %{REQUEST_URI} !/forum/ RewriteRule ^(.*)$ /forum/$1 [L] 

As far as I understood from manages, rewriterule only works with the query string with the clipped address to the .htacess file. Accordingly, implicitly change http_host, i.e. domain / subdomain its means impossible?

 RewriteEngine On RewriteBase / RewriteRule ^(.*)$ /index.php?$1 [L,QSA] # скрываю index.php RewriteCond %{HTTP_HOST} ^news\.site\.com$ [NC] RewriteCond %{REQUEST_URI} !^/news/ RewriteRule ^(.*)$ /news/$1 [L] 

In this case, it does not work at all - the news / index.php? News / index.php & news / index.php looping occurs.

 RewriteCond %{HTTP_HOST} ^news\.site\.com$ [NC] RewriteCond %{ENV:REDIRECT_FINISH} !^$ RewriteRule ^(.*)$ /news/$1 [L,E=FINISH:1] 

In this version there is no looping, but still the main page news.site.com opens - the same as main site.com, since Subdomain processing enabled.

Tell me please - what I want from htacess is real or not? You can, in principle, issue the page news.site.com/news. But in this case, do not drag fonts from another domain. It is necessary to turn off caching of static files to enable Access-Control-Allow-Origin, which is also not very desirable to do. You can make a copy-paste of the code in the news subdomain - but it is also not interesting to follow then two identical projects. Moreover, most likely you will need another subdomain similar news. In general, please help. We need all this idea to get the reference mass from subdomains with articles on the main domain.

    0