Install Joomla in a subdirectory

前端 未结 4 535
甜味超标
甜味超标 2021-01-06 20:21

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 li

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 20:49

    I first tried the accepted answer. However, that answer also redirects existing files and folders to the new subdir.

    For this reason I used:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteCond %{REQUEST_URI} !^/subdir/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /subdir/$1
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteRule ^(/)?$ subdir/index.php [L]
    

    instead.

    I'm aware that this is not the best solution as it doesn't hide the sub directory properly. However, it allows to keep the existing code on that site working.

提交回复
热议问题