把网站域名改为子文件夹,不改变URL的方式(.htaccess)


# Change yourdomain.com to be your primary domain.

RewriteCond %{HTTP_HOST} ^(www.)?yourprimarydomain.com$

# Change 'subfolder' to be the folder you will use for your primary domain.

RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't change this line.

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

# Change 'subfolder' to be the folder you will use for your primary domain.

RewriteRule ^(.*)$ /subfolder/$1

# Change yourdomain.com to be your primary domain again.
# Change 'subfolder' to be the folder you will use for your primary domain
# followed by / then the main file for your site, index.php, index.html, etc.

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