.ht访问两个站点
我有两个站点在同一个域中运行(相同的站点,但旧的 WordPress 和新的自定义)
我需要做:
如果客户端请求存在的文件,那么他可以看到它:(这有效)
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
}
I have two sites running in the same domain (the same sites, but the old in wordpress and the new custom)
I need to do:
If the client ask for a file that exists, then he can see it: (this works)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Any other request goes to index.php
RewriteRule . /index.php [L]
Ok... but if you ask for / (www.site.com) you will have be redirected to www.site.com/site2 without going trough index.php
how can I achieve this?
in pseudocode (bad english, sorry)
if(request == "/" || request == www.site.com) {
redirect site2/
} else if(ask_for_a_file_that_exists) {
server file
} else {
use old index.php
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的东西应该有效:
Something like this should work: