htaccess mod重写需要重写

问题描述:

重定向mydomain.rumydomain.ru/rushtaccess mod重写需要重写

如果我写:

RewriteCond %{HTTP_HOST} !^mydomain\.ru/rus/$ [NC] 
RewriteRule ^(.*)$ http://mydomain.ru/rus/$1 [R=301,L] 

当我有无尽的重定向。有任何想法吗?

主机会在两种情况下是mydomain.ru,这就是为什么你会得到无尽的重定向 试试这个:

RewriteCond %{REQUEST_URI} !^/rus/ 
RewriteRule ^(.*)$ rus/$1 

这将请检查是否或不是你正在浏览的东西在RUS文件夹,如果没有,则将您重定向到该子文件夹