.htaccesss两个网站
问题描述:
我在同一个域中运行两个站点(相同的网站,但在WordPress的旧的和新的自定义).htaccesss两个网站
我需要做的:
如果客户索要存在的文件,那么他就可以看出来:(这工作)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
任何其他请求转向到index.php
RewriteRule . /index.php [L]
好的...但是,如果你问/(www.site.com),你将被重定向到www.site.com/site2而没有进入谷底index.php
我该怎么做到这一点? 伪代码(英语不好,对不起)
if(request == "/" || request == www.site.com) {
redirect site2/
} else if(ask_for_a_file_that_exists) {
server file
} else {
use old index.php
}
答
像这样的东西应该工作:
# 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_rewrite'规则? – 2010-09-10 07:39:03