[英]IP address is shown instead of the actuall website address in the browser address bar
[英]Hide the directory in the address bar of the browser
文件.htaccess具有以下指令:
RedirectMatch permanent ^$ /moby/
当我在浏览器的地址栏中输入网站地址时: http://mobyx.net/
: http://mobyx.net/
它显示目录已重定向到: http://mobyx.net/moby/
: http://mobyx.net/moby/
如何隐藏目录?
您当前正在执行重定向(如果客户端转到mobyx.net/moby
则告诉客户端重试mobyx.net
)。 您实际要做的是内部重写。 这对于客户端是不可见的。 您可以为此使用RewriteRule
。 请参阅文档以获取更多信息。
首先确保在httpd.conf中启用了mod_rewrite
。 然后将以下内容添加到您的.htaccess中
RewriteRule ^$ /moby/ [L]
例如,这会将内部http://mobyx.net/
重写为http://mobyx.net/moby/
,而不是http://mobyx.net/index.php
。 如果要在网站上重写所有内容,请使用:
RewriteCond %{REQUEST_URI} !^/moby
RewriteRule ^(.*)$ /moby/$1 [L]
如果该URL尚未指向/ moby子目录,则将重写该URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.