I have Craft public files set up within subdirectories of a primary domain’s web root.
public_html/ # default web root
public_html/example.com/public_html/ # Craft public files here
The following .htaccess rules allow for the public_html
subdirectory to act as the new web root. This is the .htaccess within the first public_html
directory.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$
RewriteCond %{REQUEST_URI} !^/example.com/public_html/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /example.com/public_html/$1
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(/)?$ example.com/public_html/index.php?p=$1 [QSA,L]
It works until I go to example.com/admin.
I can login and cp works, but the URL is http://example.com/example.com/public_html/admin/dashboard
I'd like to remove the subdirectories from the above admin URL for mere aesthetic reasons, but can’t seem to nail it down.
Note: When going directly to http://example.com/admin/dashboard
, for example, the URL remains as is, but all the internal links have the subdirectories.