所以我试图为我的困境实施一些解决方案,但他们都已经部分失败了。
我已将我的博客从www.website.com/blog/移至blog.website.com
blog.website.com位于我的根网站目录之外的目录中
初始位置后所有网址都相同:例如...... 旧网站www.website.com/blog/wp-admin = blog.website.com/wp-admin
这是一个wordpress网站,如果这有助于或有所作为。
这就是我现在所拥有的。重定向主文件夹但不重定向子文件夹...
RewriteEngine on
RewriteBase /
#if not already blog.website.com
RewriteCond %{HTTP_HOST} !^blog\.website\.com$ [NC]
#if request is for blog/, go to blog.website.com
RewriteRule ^blog/$ http://blog.website.com/$1 [L,NC,R=301]
答案 0 :(得分:1)
您需要(.*)
:
RewriteEngine on
RewriteBase /
#if not already blog.website.com
RewriteCond %{HTTP_HOST} !^blog\.website\.com$ [NC]
#if request is for blog/, go to blog.website.com
RewriteRule ^blog/(.*)$ http://blog.website.com/$1 [L,NC,R=301]