0
我已經有網站www.example.com駐留在/ public_html /網站。htaccess RewriteCond重寫規則
現在我想指出www.example.com/anothersite爲/ public_html/anotherite。
我該怎麼辦?
中/的public_html中的.htaccess:
RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteCond %{REQUEST_URI} !site/
RewriteRule (.*) /site/$1 [L]
中的.htaccess中/的public_html /網站:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
在/的public_html中的.htaccess我都試過,但它說錯誤404頁面找不到!:
RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^anothersite/(.*)$ http://example.com/anothersite/$1 [R=301,NC,L]
RewriteCond %{REQUEST_URI} !site/
RewriteRule (.*) /site/$1 [L]
但我不知道爲什麼它不是最後工作,但現在它的工作與上面的代碼...
在你給將指向example.com/site雙方和example.com/anothersite到/的public_html /網站htaccess的。不是嗎? – itsazzad
是的以上規則會跳過'/ anothersite',默認情況下'http:// site.com/anothersite'會加載'/ anothersite' – anubhava
但它不起作用。 http://example.com/anothersite指向http://example.com/site也 – itsazzad