[Zen Cart] Adding a redirect rule

Magic SEO URLs for Zen Cart.
wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

[Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 1:51 am

Hi
would you know how i can add a rule to my htaccess to permanently redirect:

http://www.mysite.com/?abcd

to

http://www.mysite.com/?aid=abcd

Thanks

L.

inveo
Inveo Support
Posts: 1276
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 10:20 am

Code: Select all

RewriteCond %{QUERY_STRING} ^([a-z]*)$ [NC]
RewriteRule (.*) http://www.mysite.com/$1?aid=%1 [R=301,L]


This should work for any URL on your site ending with "?aid=abcd".

wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 2:19 pm

You mean it should work with any url ending with "?abcd" as the idea is to redirect those urls to the other...

inveo
Inveo Support
Posts: 1276
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 2:56 pm

Yes.

wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 4:30 pm

Thanks very much!

wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 4:34 pm

Just another question, would it work too for:

?abcd2

to
?aid=abcd2

I mean with letters and numbers?

inveo
Inveo Support
Posts: 1276
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 4:41 pm

It should be changed by the following way:

Code: Select all

RewriteCond %{QUERY_STRING} ^([a-z0-9]*)$ [NC]
RewriteRule (.*) http://www.mysite.com/$1?aid=%1 [R=301,L]

wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 4:49 pm

The new rule you provide is also good for:


?abcd2
?abc2d
?a2bcd

I mean no matter the order letter number?

inveo
Inveo Support
Posts: 1276
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 4:54 pm

Yes.

wirefram
Posts: 23
Joined: Sat Oct 15, 2011 1:49 am

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 4:55 pm

Thanks a lot!