Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect dynamic URL matching expression - please help

         

natastna22

1:26 pm on Dec 26, 2010 (gmt 0)

10+ Year Member



Hi guys. I've spent the last few hours trying to get my head around this problem. I've got a site using some translation software and it works for the most part but it cannot work in the checkout stages so I want to redirect the url it's creating www.mysite.com/nl/index.php?etc to www.mysite.com/index.php?etc

The URL I get atm is [mysite.com...]

and I would love to get [mysite.com...]

I've been trying different combinations of things but I simply don't have the experience with mod rewrite, if anyone could point me in the right direction, I'd greatly appreciate it. Thanks for your time. Ant.

g1smd

5:16 pm on Dec 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What have you tried so far?

You'll need a RewriteCond looking at THE_REQUEST or QUERY_STRING as well as the RewriteRule itself.

For a redirect you'll also need the [R=301,L] flags.

natastna2

6:29 pm on Dec 26, 2010 (gmt 0)

10+ Year Member



I've tried quite a few different things so far. Here is what I'm trying at the moment:

RewriteCond %{QUERY_STRING} page=checkout.index&option=com_virtuemart&Itemid=65&redirected=1&Itemid=65
RewriteRule ^index\.php$ [seed-city.com...] [R=301]

That works fine in redirecting the same page to the same page. So all I want is to specify that the rewrite cond query string has to be after nl/ in the url, andn the same with the other languages, de/ ja/ etc. I've tried rewriteRule ^nl\index\.php but that didn't work. Any help would be greatly appreciated.

jdMorgan

4:59 pm on Jan 5, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure I understand exactly what you want, but if your intent is to redirect either
/nl/index.php?page=checkout.index&option=com_virtuemart&Itemid=65&redirected=1&Itemid=65
or
/be/?page=checkout.index&option=com_virtuemart&Itemid=65&redirected=1&Itemid=65
to
/?page=checkout.index&option=com_virtuemart&Itemid=65&redirected=1
that is, to redirect to remove the 'index.php' and the extra 'ItemID=65' if present, then this code, placed in www.example.com/.htaccess, should do:

RewriteCond %{QUERY_STRING} ^page=checkout\.index&option=com_virtuemart&Itemid=65&redirected=1&Itemid=65$
RewriteRule ^[a-z]{2}/(index\.php)?$ http://www.example.com/?page=checkout.index&option=com_virtuemart&Itemid=65&redirected=1 [R=301]

Jim