Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Joomla in a subdirectory

As some of you may know, Wordpress has an options in settings to allow site installation in a subdirectory, while having the site URL be the main domain. It was something like "Site url" and "Wordpress url". I'm looking for something like this in Joomla. I know there is no inbuilt option for it, but I'd rather not have to move all the files if possible. And please, explain it to me like to a five year old, just in case :)

like image 221
Kard Nails Avatar asked Dec 02 '25 22:12

Kard Nails


1 Answers

To move the whole joomla installation to a subfolder on the server (http://example.com/subdir), but still access it from the root (http://example.com) I did the following:

  • Move your whole installation to the subdir-folder
  • In configuration.php, set $live_site = "http://example.com";
  • Also change the tmp and log-folders in configuration.php
  • Add a .htaccess-file to the root-folder:

(The code is modified from this excellent answer)

RewriteEngine on
RewriteCond %{THE_REQUEST} subdir/
RewriteRule ^subdir/(.*) http://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !subdir/
RewriteRule ^(.*)$ /subdir/$1 [L]

Modify the default joomla .htaccess-file, now in the /subdir-folder, to include a RewriteBase:

RewriteBase /subdir/

After these modifications it seems everything works the way it should.

like image 115
jonasfh Avatar answered Dec 07 '25 16:12

jonasfh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!