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