的.htaccess屏蔽网址和重定向域名子目录 [英] .htaccess to mask url and redirect domain name to subdirectory

查看:150
本文介绍了的.htaccess屏蔽网址和重定向域名子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计 我想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

这篇关于的.htaccess屏蔽网址和重定向域名子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆