我想编辑 Wordpress 3.5 .htaccess文件来定义一些网址重定向规则,例如:
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>
但浏览器说
找不到页面
这有点尴尬,不是吗?
任何想法......我怎么能这样做??
答案 0 :(得分:1)
您不想将Redirect
与mod_rewrite结合使用,只需坚持使用mod_rewrite即可。将Redirect
替换为:
RewriteRule ^my_site/blog/cat/hello-world/ /my_site/cat/hello-world/ [L,R=301]