[英].htaccess - hide Joomla 3 installation directory from URL
I just created a Joomla 3 site (offline at the moment). 我刚刚创建了一个Joomla 3网站(目前处于离线状态)。 Joomla was installed at
www.mydomain.com/jo/
directory, and at .htaccess
file I included the following rule to redirect from www.mydomain.com
to www.mydomain.com/jo/
, and it's working fine: Joomla安装在
www.mydomain.com/jo/
目录中,并且在.htaccess
文件中,我包含以下规则,用于从www.mydomain.com
重定向到www.mydomain.com/jo/
,并且工作正常:
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ jo [L]
I'm using URL Rewriting also working great after making adjustment at .htaccess
在
.htaccess
进行调整后,我正在使用URL重写,效果也很好
I searched for two days how to get rid of /Jo directory in URL. 我搜索了两天如何摆脱URL中的/ Jo目录。 I found a code which work partially:
我找到了部分起作用的代码:
Options +FollowSymLinks
RewriteRule !^jo(/.*)?$ /jo%{REQUEST_URI} [QSA,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^jo(/(.*))?$ /$2 [R=301,L]
The problem is it hide the directory on website landing page / homepage, as menu item or article is selected it show directory in URL. 问题是它隐藏了网站登录页面/主页上的目录,因为选择了菜单项或文章,它会在URL中显示目录。
How to achieve this? 如何实现呢?
You can use the following code to remove /jo/ dir completly from your urls : 您可以使用以下代码从您的网址中完全删除/ jo /目录:
RewriteEngine on
RewriteCond %{THE_REQUEST} /jo/([^\s]+) [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteRule ^((?!jo).*)$ /jo/$1 [NC,L]
in configuration.php you need to set 在configuration.php中,您需要设置
$live_site = "http://www.example.com";
(SO dont allow mydomain.com) (因此不允许mydomain.com)
Check this answer for more info: 检查此答案以获取更多信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.