简体   繁体   English

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

[英]Mod_rewrite to direct subdirectory to another URL

I am trying to play with Apache Mod_rewrite and I cant get this to work. 我正在尝试使用Apache Mod_rewrite,我无法让它工作。

I want to redirect 我想重定向

xyz.com/blog to xyz.wordpress.com xyz.com/blog到xyz.wordpress.com

I edited the .htaccess file to add this line. 我编辑了.htaccess文件来添加这一行。

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

But it doesnt work. 但它不起作用。

Try this one. 试试这个吧。

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

Also don't forget to add 另外别忘了添加

RewriteEngine on

on top of RewriteRule. 在RewriteRule之上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM