简体   繁体   English

htaccess URL 301重定向后重写不起作用

[英]htaccess URL Rewrite not working after 301 redirect

I have the following url rewrite:我有以下 url 重写:

RewriteRule ^info/([^/\.]+)/?$ info.php?page=info&subpage=$1 [L]

Originally the parameters were the page id's ie 0-10.最初的参数是页面ID,即0-10。 I have now changed this so the URLs have more meaningful slug names to reflect the content.我现在已经改变了这个,所以 URL 有更有意义的 slug 名称来反映内容。

I have now set up the 301 redirects, for example:我现在已经设置了 301 重定向,例如:

Redirect 301 /info/0 http://www.example.com/info/intro

But the problem is, the redirect doesn't go to the url rewrite (http://www.example.com/info/intro).但问题是,重定向不会 go 到 url 重写(http://www.example.com/info/intro)。 Instead it shows the full url (http://www.example.com/info.php?page=info&subpage=0)相反,它显示了完整的 url (http://www.example.com/info.php?page=info&subpage=0)

How can it get it to keep the rewrite?怎样才能让它保持重写?
Many thanks非常感谢

As posted by LazyOne, the solution was to use RewriteRule:正如 LazyOne 所发布的,解决方案是使用 RewriteRule:

RewriteRule ^info/0$ http://www.example.com/info/intro [R=301,L] 

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

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