需要帮助屏蔽网址 [英] Need help Masking a URL
问题描述
我需要帮助屏蔽的URL。我有我不想让别人知道我网站上的一个子域。所以,我所需要的帮助是这样的:
I am need help "masking" a url. I have a subdomain that I do not want people to know about on my website. So what I am needing help with is this:
我的网站是:www.example.com
My website is: www.example.com
我有一个子域:sub.example.com/test.php
I have a subdomain: sub.example.com/test.php
当有人点击指向sub.example.com/test.php~~V一个链接,我不希望sub.example.com/test.php在地址栏显示。我想为www.example.com显示代替。
When someone clicks on a link that points to sub.example.com/test.php, I do not want "sub.example.com/test.php" to show in the url bar. I would like for www.example.com to show instead.
任何帮助是极大AP preciated!
Any help is greatly appreciated!
推荐答案
当你要链接到 sub.example.com/test.php
,更改链接别的东西,像 www.example.com/sub/test.php
什么的。然后在文档根.htaccess文件的 www.example.com
补充一点:
When you want to link to sub.example.com/test.php
, change the link to something else, like www.example.com/sub/test.php
or something. Then in your .htaccess file in the document root for www.example.com
add this:
RewriteEngine On
RewriteRule ^sub/(.*)$ http://sub.example.com/$1 [L,P]
这将内部代理的 www.example.com/sub /
到 sub.example.com
任何要求。所以,当有人请求 http://www.example.com/sub/path/file.html ,他们真正得到 http://sub.example.com/path/file.html 但他们的URL地址栏还是有example.com URL。你只需要确保改变所有的链接sub.example.com到example.com/sub~~V /
This will internally proxy any request for www.example.com/sub/
to sub.example.com
. So when someone requests http://www.example.com/sub/path/file.html, they really get http://sub.example.com/path/file.html except their URL address bar still has the example.com URL. You just need to make sure to change all of your links to sub.example.com to example.com/sub/
这篇关于需要帮助屏蔽网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!