需要帮助实现重定向+域中的.htaccess屏蔽。这部分工作。它适用于子页和子目录,但不是域本身。
Need help with achieving redirection + domain masking with .htaccess. It is partially working. It works for sub–pages and sub-directories but not the domain itself.
我有两个域redir1和redir2。 我们的目标是实现重定向与的.htaccess和屏蔽是这样的:
I have two domains "redir1" and "redir2". The goal is to achieve redirection with .htaccess and masking like this:
http://redir2 —> http://redir1
http://redir2/sub.php —> http://redir1/sub.php
http://redir2/index.php —> http://redir1/index.php
和URL显示访客必须保持他们进入了什么:
And url displayed to visitor has to remain what they entered:
http://redir2
http://redir2/sub.php
http://redir2/index.php
但是,如果他们进入的http:// redir1
他们应该看到的http:// redir1
在网址
But if they entered http://redir1
they should see http://redir1
in url.
每个域有以下两个文件: 的index.php sub.php
each domain has two following files: index.php sub.php
下面是code在.htaccess:
Here is the code in .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?redir2$ [NC]
RewriteRule ^ http://redir1%{REQUEST_URI} [L,NE,P]
这是工作非常好有域(子页和子目录)后,所有的东西要求。例如:
It is working very well for all requests that have something after domain (sub-pages and sub-directories). For example:
http://redir2/sub.php
http://redir2/index.php
但是,如果我输入只是的http:// redir2 /
我得到一个未找到错误:
But if I type in just http://redir2/
I get a "Not found" error:
The requested URL /index.html was not found on this server.
事实上,我没有index.html的,但我的index.php 如何在不增加index.html的解决这一问题?
Indeed I don't have index.html but I have index.php How to solve the issue without adding index.html?
感谢
也许有的DirectoryIndex的index.php
?