[英]wordpress: htaccess redirect url
我想编辑Wordpress 3.5 .htaccess文件以定义一些URL重定向规则,例如:
Redirect http://localhost/my_site/blog/cat/hello-world to http://localhost/my_site/cat/hello-world
我试过了
Redirect 301 /localhost/my_site/blog/cat/hello-world/ http://localhost/my_site/hello-world/
并且
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_site/
Redirect 301 http://localhost/my_site/blog/cat/hello-world/ http://localhost/my_site/cat/hello-world/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my_site/index.php [L]
</IfModule>
但是浏览器说
网页未找到
这有点尴尬,不是吗?
任何想法..我怎么做..?
您不想将Redirect
与mod_rewrite结合使用,只需坚持使用mod_rewrite。 将Redirect
替换为:
RewriteRule ^my_site/blog/cat/hello-world/ /my_site/cat/hello-world/ [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.