Mod_rewrite将子目录定向到另一个URL


Mod_rewrite to direct subdirectory to another URL

我正在尝试使用Apache Mod_rewrite,但我无法使用它。

我想重定向

xyz.com/blog到xyz.wordpress.com

我编辑了.htaccess文件来添加这一行。

RewriteRule ^blog/?$ http://xyz.wordpress.com/$1 [NC]

但它不起作用。

试试这个。

RewriteRule ^blog/(.*)$ http://xyz.wordpress.com/$1 [NC]

也不要忘记添加

RewriteEngine on

位于RewriteRule之上。