PDA

View Full Version : Redirect Problem


legacytack
06-24-06, 09:15 PM
Ok, I am trying to redirect my old Miva 4 pages to the new Miva 5 pages using mod_rewrite. When I just redirect the whole folder it works:

RewriteRule ^/Merchant2/(.*)$ /mm5/$1 [R=301]

But I used the Copernicus Search Friendly Links for my MM4 store, and I have done the rewrite for directory style links for MM5. I want the MM4 short links to redirect to the MM5 short links. The best way I came up with is the redirect MM4 SFL to MM4 regular links, and then MM4 regular links to MM5 short links, but it doesn't work. Here is the code I used:

RewriteRule ^/Merchant2/merchant.mvc?page=LT/CTGY/(.*)$ /Merchant2/merchant.mvc?Screen=CTGY&Category_Code=$1&Store_Code=LT
RewriteRule ^/Merchant2/merchant.mvc?page=LT/PROD/(.*)/(.*)$ /Merchant2/merchant.mvc?Screen=PROD&Product_Code=%2&Category_Code=%1&Store_Code=LT
RewriteRule ^/Merchant2/merchant.mvc?page=LT/PROD/(.*)$ /Merchant2/merchant.mvc?Screen=PROD&Product_Code=%1&Store_Code=LT
RewriteRule ^/Merchant2/merchant.mvc?Screen=CTGY&Category_Code=(.*)&Store_Code=LT$ /c/$1/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?Screen=PROD&Product_Code=(.*)&Category_Code=(.*)&Store_Code=LT$ /pc/$1/$2/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?Screen=PROD&Product_Code=(.*)&Store_Code=LT$ /p/$1/ [R=301]

Can anyone tell me what I'm doing wrong? Thanks!

legacytack
06-28-06, 05:57 PM
I still haven't figured this out. If someone could point me in the right direction I would really appreciate it. Thanks!

Bruce - PhosphorMedia
06-28-06, 06:03 PM
I would try just creating a separate rewrite rule to transistion MM4 short links to MM5 Short links...much less confusing and the same information should apply, lastly, be sure to include a rewrite set to take standard MM4 links (and standard MM5 links) to the new MM5 short links.

Would need to see how your MM5 short links are to offer more assistance.

legacytack
06-28-06, 06:50 PM
Ok, I tried this to rewrite MM4 short links to MM5 short links and MM4 standard links to MM5 short links, but it still doesn't work. If you go to any MM4 page it stays in MM4.
RewriteRule ^/Merchant2/merchant.mvc?page=LT/CTGY/(.*)$ /c/$1/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?page=LT/PROD/(.*)/(.*)$ /pc/$2/$1/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?page=LT/PROD/(.*)$ /p/$1/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?Screen=CTGY&Category_Code=(.*)&Store_Code=LT$ /c/$1/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?Screen=PROD&Product_Code=(.*)&Category_Code=(.*)&Store_Code=LT$ /pc/$1/$2/ [R=301]
RewriteRule ^/Merchant2/merchant.mvc?Screen=PROD&Product_Code=(.*)&Store_Code=LT$ /p/$1/ [R=301]
I have tried just rewriting the whole /Merchant2/ directory to /mm5/ and that works as long as you don't go any further. If I try to do this it doesn't work:
RewriteRule ^/Merchant2/merchant.mvc?Screen=(.*)$ /mm5/merchant.mvc?Screen=$1
Here are the rewrite rules for my MM5 short links (which work):
RewriteCond %{REQUEST_URI} ^/p/(.*)/(.*) [NC]
RewriteRule (.*) /mm5/merchant.mvc?Screen=PROD&Product_Code=%1&Store_Code=LT [L]
RewriteCond %{REQUEST_URI} ^/pc/(.*)/(.*)/(.*) [NC]
RewriteRule (.*) /mm5/merchant.mvc?Screen=PROD&Product_Code=%1&Category_Code=%2&Store_Code=LT [L]
RewriteCond %{REQUEST_URI} ^/c/(.*)/(.*) [NC]
RewriteRule (.*) /mm5/merchant.mvc?Screen=CTGY&Category_Code=%1&Store_Code=LT [L]
Any more suggestions?