Wordpress htaccess重定向url

Wordpress htaccess重定向url,wordpress,.htaccess,Wordpress,.htaccess,我想编辑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/ 而且 <

我想编辑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>

重新启动发动机
重写基本/我的网站/
重定向301http://localhost/my_site/blog/cat/hello-world/ http://localhost/my_site/cat/hello-world/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/my_site/index.php[L]
但是浏览器说

找不到页面

这有点尴尬,不是吗


任何想法。。我怎样才能做到这一点?

如果您不想将
重定向
与mod_rewrite结合使用,请坚持mod_rewrite。将
重定向
替换为:

RewriteRule ^my_site/blog/cat/hello-world/ /my_site/cat/hello-world/ [L,R=301]