的.htaccess屏蔽网址和重定向域名子目录子目录、屏蔽、重定向、网址

2023-09-02 20:40:47 作者:Coral 珊瑚

嗨伙计 我想AP preciate一定的.htaccess建议。

Hi folks I'd appreciate some .htaccess advice.

我有两个词preSS装置。 A,这是在我的ISP的Linux服务器的根目录和B,这是所谓的directoryB,在同一台服务器的子目录

I have two wordpress installations. "A" which is in my ISP's Linux server root directory and "B", which is in a subdirectory of the same server called "directoryB".

实际结构是:= A.com A.com/directoryB /

Actual structure is:= A.com A.com/directoryB/

我拥有两个域名A.com和B.com。我希望人们使用的地址B.com上directoryB访问一切,当,不A.com/directoryB /.

I own two domain names A.com and B.com. I want people to use the address B.com when accessing everything on directoryB, not A.com/directoryB/.

我要离开了现实,A孤独 - 没有重定向

I want to leave the "real" "A" alone - no redirections!

我一直确信这可以通过使用.htaccess文件来实现,但我到目前为止还没有! 我已成功地面具,B,使用的cPanel主页,但它恢复到A.com/directoryB/一旦你远离主页。我也不能肯定是否的.htaccess应该是在根目录或子目录。

I have been assured this can be done using the .htaccess file, but I've failed so far! I have managed to "mask" the home page of "B" using cPanel, but it reverts back to A.com/directoryB/ once you move away from the home page. I'm also not sure if the .htaccess ought to be in the root or subdirectory.

我要的是它出现在地址栏上的每一次面膜A.com/directoryB/与B.com/ ......

All I want is to mask the A.com/directoryB/ with B.com/ every time it appears on the address bar......

在此先感谢您的帮助!

推荐答案

在的public_html htaccess的是: -

The htaccess in public_html is:-

RewriteEngine叙述在 永久重定向/ directoryB http://B.com 重写规则^测试/([^ /] *)/ $ /测试/登录/?ID = $ 1 的RewriteBase / 重写规则^ $的index.php - [L] 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d 重写规则。的index.php [L]   

RewriteEngine On Redirect permanent /directoryB http://B.com RewriteRule ^test/([^/]*)/$ /test/login/?id=$1 RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

选项-Indexes

Options -Indexes

===============这是来自directoryB

=============== this is the htaccess from "directoryB"

RewriteEngine叙述在 的RewriteBase / directoryB / 重写规则^ $的index.php - [L] 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d 重写规则。 /directoryB/index.php [L]   

RewriteEngine On RewriteBase /directoryB/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /directoryB/index.php [L]

选项-Indexes

Options -Indexes