i am currently preparing a shop-move (xt:commerce). The Shop uses SEF-URLs (shopstat).
In the new shop the link-structure will change so i thought i will build a rewrite map to map old URLs to new ones.
So currently there already is a rewrite going on:
- Code: Select all
RewriteRule (.*)::(.+)\.html$ product_info.php?products_id=$2 [qsappend,L]
This will apply for example to
- Code: Select all
http://www.example.com/category_name/product_name::1234.html
Now the NEW URL to the same product in the new shop could be completely different:
- Code: Select all
http://www.example.com/other_category_name/other_product_name::5678.html
So i would put it in the map like this:
- Code: Select all
1234 /other_category_name/other_product_name::5678.html
Now, here is my rewrite rule to access the rewritemap:
- Code: Select all
RewriteRule ^.*::(.*)\.html$ ${remap:$1} [R=301,L]
Unfortunately this doesn't work. The url ends up with:
- Code: Select all
http://www.example.com/path/to/my/doc_root/
On the other hand, this thing works, when i point the target in the rewritemap to a REAL existing url:
- Code: Select all
1234 /thisfiledoesexist.php
Which is not what i want obviously.
How can i get this to work:
1. lookup in rewrite map if entry exists
2. if yes, redirect (301) to the new target which will be rewritten properly
3. if not, just keep going to the next rule which will rewrite to the products.php
Here is the .htaccess to sum it up:
- Code: Select all
# rule no. 1
# should lookup if entry in rewritemap exists
# if yes, redirect to found target and go to rule no. 2
RewriteRule ^.*::(.*)\.html$ ${remap:$1} [R=301,L]
# rule no.2
# just map to the correct product
RewriteRule (.*)::(.+)\.html$ product_info.php?products_id=$2 [qsappend,L]
Sorry for being noobish but i am going crazy over this (many hours spent) and kinda lost it.
Please help.
Thank you.