.htaccess .HTS访问两个站点
我有两个站点在同一个域中运行(相同的站点,但是wordpress中的旧站点和新的自定义站点) 我需要做: 如果客户要求一个存在的文件,那么他可以看到它:(这样行) 任何其他请求都会转到index.php.htaccess .HTS访问两个站点,.htaccess,.htaccess,我有两个站点在同一个域中运行(相同的站点,但是wordpress中的旧站点和新的自定义站点) 我需要做: 如果客户要求一个存在的文件,那么他可以看到它:(这样行) 任何其他请求都会转到index.php RewriteRule . /index.php [L] 好的。。。但是,如果您请求/(www.site.com),您将被重定向到www.site.com/site2,而不必经过index.php RewriteRule . /index.php [L] 我怎样才能做到这一点? 伪代码(
RewriteRule . /index.php [L]
好的。。。但是,如果您请求/(www.site.com),您将被重定向到www.site.com/site2,而不必经过index.php
RewriteRule . /index.php [L]
我怎样才能做到这一点?
伪代码(英语不好,抱歉)
像这样的方法应该会奏效:
# Check if the request was for the root, and if so, redirect
# internally to the site2 folder
RewriteRule ^$ /site2/ [L]
# Otherwise, let the existing site take care of the rest
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
要执行内部重定向还是外部重定向?另外,新站点是否在
site2
目录的.htaccess
文件中有自己的mod\u rewrite
规则?
# Check if the request was for the root, and if so, redirect
# internally to the site2 folder
RewriteRule ^$ /site2/ [L]
# Otherwise, let the existing site take care of the rest
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]