I am trying to get a mod_rewrite working correctly.
Here is the code:
RewriteCond %{QUERY_STRING} ^main_page=product_info&pr开发者_如何学运维oducts_id=301$ 
RewriteRule ^index\.php$          
/blog/shop/index.php?route=product/product&product_id=301? [R=301,L]
It works, but in the end of the new URL %3f is added. Can somebody help me to get it work?
Put no-escape flag NE at the end:
RewriteRule ^index\.php$          
/blog/shop/index.php?route=product/product&product_id=301? [R=301,L,NE]
%3f is the question mark at the end of your statement. Take that out and you should be good.
RewriteCond %{QUERY_STRING} ^main_page=product_info&products_id=301$ 
RewriteRule ^index\.php$          
/blog/shop/index.php?route=product/product&product_id=301 [R=301,L]
%3f is the "?" you have at the end of your "Target URL" - just URL escaped. Is this really supposed to be there?
The %3f is the ? at the end of your replacement in percent-encoding. Just drop the ? at the end:
RewriteCond %{QUERY_STRING} ^main_page=product_info&products_id=301$ 
RewriteRule ^index\.php$ /blog/shop/index.php?route=product/product&product_id=301 [R=301,L]
You would only use a ? at the end to indicate an empty query so that the requested query does not get appended to the new URL if it does not contain a query.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论