Redirect htaccess from subdomain to root

I have several domains in one account, and currently I have RewriteRule installed to redirect the root URL (www.root.com) to a subdirectory (/ public_html / root /).

However, I have few directories in the root (/ public_html / xyz /) with which I would like to access from the root URL (www.root.com/xyz). Is it possible to write a redirect for this, or place this folder in the / public _html / root / directory?

This is what I have .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?root.com$
RewriteCond %{REQUEST_URI} !^/root/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTP_HOST} ^(www.)?root.com$
RewriteRule ^(/)?$ root/index.php [L]

Thanks in advance!

+3
source share
1 answer

This seems to work for a simple Alias .

Try this in your domain VirtualHost:

Alias /xyz/ /public_html/xyz/
0
source

Source: https://habr.com/ru/post/1742337/


All Articles