因此,我使用的託管提供商不支持虛擬主機或任何類似的東西,所以我試圖將我的主域重寫爲子目錄。因此,例如我目前有:如何使用.htaccess重寫除子域以外的子目錄的所有流量?
example.com改寫爲example.com/sites/example.com/
這在.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} !^/sites/example.com/.*$
RewriteRule ^(.*)$ /sites/example.com/$1
之所以使用下面的代碼工作正常這是在同一臺服務器上有其他域,我不希望被主域訪問並保持我的服務器組織。
因此,我還將example2.com作爲指向/sites/example2.com的附加域,並且工作正常。
但是,我也有指向不同子目錄的子域,例如指向/ projects /的projects.example.com,但這些子域只是被重寫到/sites/example.com/目錄。
我的問題是我如何(也可能)解決這個問題?提前致謝!