I just created a Joomla 3 site (offline at the moment). 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:
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ jo [L]
I'm using URL Rewriting also working great after making adjustment at .htaccess
I searched for two days how to get rid of /Jo directory in URL. 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.
How to achieve this?
You can use the following code to remove /jo/ dir completly from your urls :
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
$live_site = "http://www.example.com";
(SO dont allow mydomain.com)
Check this answer for more info:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.