[Zen Cart] Adding a redirect rule

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

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 5:16 pm

Hi

I have a problem, the redirect works fine but it does redirect everything like:

http://www.mysite.com/abcd8/login.php

to

http://www.mysite.com/abcd8/login.php?aid=

which is a big problem as for example, i can no longer log as admin...

I there a way to redirect only urls with this very specific format:

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

to
http://www.mysite.com/?aid=abcd2

and not the others urls?

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

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 5:25 pm

Then change it to:

Code: Select all

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


Please bear in mind there may be also other collisions with more URLs. It is just to general to identify "?abcd". It can be (partially) worked-around if length or minimal number of characters would be known.

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

Re: [Zen Cart] Adding a redirect rule

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

There are always only 8 random numbers letters after the ? :

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

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

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

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 5:39 pm

Then it can be changed to:

Code: Select all

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


But there still be collisions with other 8 chars query strings.

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

Re: [Zen Cart] Adding a redirect rule

Postby wirefram » Tue Feb 21, 2012 5:47 pm

You mean collision in case I have the same exact pattern

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

/ + ? + 8 numbers letters

or could be other pattern?

as long there is no

/?

it should not redirect other urls right?

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

Re: [Zen Cart] Adding a redirect rule

Postby inveo » Tue Feb 21, 2012 6:27 pm

Currently, it will work with any URL ending with 8 chars query string.

It means http://www.mysite.com/?xxxxxxxx or http://www.mysite.com/index.php?xxxxxxxx http://www.mysite.com/anyfile.html?xxxxxxxx etc.