【发布时间】:2014-05-21 01:00:03
【问题描述】:
我的网页以前是 blog.example.com,但现在是 example.com。我不得不删除 /blog 目录(网站托管 blog.example.com),因为我在 URL example.com/blog 上有一个 Wordpress 页面,这搞砸了。
我试过了:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog\.example\.com
RewriteRule ^(.*)$ http://www\.example\.com/$1 [L]
还有:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?blog\.example\.com$ [NC]
RewriteRule ^ http://www.example.com/%{REQUEST_URI} [NE,R=301,L]
还有:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
但这些都不会对子域产生任何影响。 我该怎么做才能将 blog.website.com/URLS 重定向到 website.com/URLS?(不创建 example.com/blog,因为它会弄乱 Wordpress 的网页网站.com/blog)
【问题讨论】:
标签: wordpress apache .htaccess redirect