I'm breaking my head in redirecting a few page from my old asp website to my new php website.
For example, I want to redirect permanently the following 2 pages from my asp website to my php website
TO
http://www.mywebsite.com/index.php?route=product/category&path=10_11
where 11 should be the link between old and new website to display the correct page.
2) shopexd.asp?id=3903&prod=food&vrnt=green&mrk=studio&cat=11
TO
index.php?route=product/product&path=10_11&product_id=3903
where the number 11 is the link between old and new url for the category and the number 3903 is the link for the product number
I have the following rewrite rule in my htaccess page for the first redirect, but it seems not be triggered. What is wrong? Please help.
RewriteCond %{REQUEST_URI} ^/shopdisplayproducts\.asp\?id=([0-9]+).*$ [NC]
RewriteRule ^shopdisplayproducts\.asp\?id=([0-9]+).*$ index.php?route=product/category&path=10_$1 [R=301,L]
I also tried:
RewriteCond %{REQUEST_URI} ^shopdisplayproducts\.asp\?id=([0-9]+).*$ [NC]
RewriteRule ^shopdisplayproducts\.asp\?id=([0-9]+).*$ index.php?route=product/category&path=10_$1 [R=301,L]
Thanks for any help Sabko
You need to use QUERY_STRING
variable in rule condition:
RewriteEngine On
# /shopexd.asp?id=3903&prod=food&vrnt=green&mrk=studio&cat=11 to
# /index.php?route=product/product&path=10_11&product_id=3903
RewriteCond %{QUERY_STRING} ^id=(\d+)&.*&cat=(\d+) [NC]
RewriteRule ^shopexd\.asp$ /index.php?route=product/category&path=10_%2&product_id=%1 [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^id=(\d+) [NC]
RewriteRule ^shopdisplayproducts\.asp$ /index.php?route=product/category&path=10_%1 [R=301,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.