简体   繁体   中英

redirect of a specific URL htaccess

I tried to apply the solution in this answer to redirecting problem. Doesn't seem to work. I'm stumped.

I need to redirect (domain.com/shop/cart.php?m=product_detail&p=7) to (domain.com/shop/category-page/product-page-c23/).

The code I tried is below:

RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$)
RewriteCond %{QUERY_STRING} !(^|&)p=7
RewriteRule cart.php /shop/category-page/product-page-c23/

I really appreciate any advice that is out there. Thank you. I'll buy you a beer.

There are some minor mistakes in your code. Try this code in .htaccess:

Options -MultiViews +FollowSymLinks
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)p=7(&|$) [NC]
RewriteRule ^shop/cart\.php/?$ /shop/category-page/product-page-c23/ [NC,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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