Page 1 of 2

[Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 1:51 am
by wirefram
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.

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 10:20 am
by inveo

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".

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 2:19 pm
by wirefram
You mean it should work with any url ending with "?abcd" as the idea is to redirect those urls to the other...

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 2:56 pm
by inveo
Yes.

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:30 pm
by wirefram
Thanks very much!

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:34 pm
by wirefram
Just another question, would it work too for:

?abcd2

to
?aid=abcd2

I mean with letters and numbers?

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:41 pm
by inveo
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]

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:49 pm
by wirefram
The new rule you provide is also good for:


?abcd2
?abc2d
?a2bcd

I mean no matter the order letter number?

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:54 pm
by inveo
Yes.

Re: [Zen Cart] Adding a redirect rule

Posted: Tue Feb 21, 2012 4:55 pm
by wirefram
Thanks a lot!

Cart  
(empty)

Cart Check out  »

Prices are tax inclusive.

The VAT rate for your country (US) * is 0,0 % because it is not a member of the European Union (EU).

* Please create an account if your country does not match.

Community feed
  • [Zen Cart] Can't execute Magic SEO URLs sitemaps
    I installed Magic SEO URLs Sitemaps Add-On for ZenCart MSU4.x/MSU5.x 2.0 on my server, when I try to generate sitemaps using: https://www.pechesudv155.owally.com/sitemaps.php I received :...
    by peter@pechesud.com
  • [phpBB3] Sharing users between phpBB / PrestaShop
    Hi i have 2 question 1- prestashop module support phpBB 3.3 ? 2- why we can not login in prestashop and phpbb with same user?
    by zohall
  • [phpBB3] AJAX Userinfo Extension
    Hi! I'm having trouble with this extension: https://www.phpbb.com/customise/db/exte ... _userinfo/ I tried asking support from the author but for no avail, since now. My request for support...
    by Lord Phobos
  • [phpBB3] Upgrade to phpBB 3.2.3
    Hello.. after Upgrade to phpBB 3.2.3 I am getting this message.. How can I solve this issue..? Thank you
    by ingbrzy
  • [phpBB3] URL path changed
    Hello.. I have changed my site path after moving to new hosting and now can not activate SEO module.. new path http://www.miuios.cz/domains/miuios.cz/ could you help me? thank you
    by ingbrzy2
Join our support forum » Pre-Sales Questions »
Featured Testimonials

Just wanted to let you know that I got it working :-) It's an awesome product you've got there!

Justin, the owner of Fokvereniging VWF

I was a little concerned about using a 3rd party SEO module for osCommerce - there were some well established ones and they were free - Magic SEO URLs for osCommerce were paid for! But I was looking at my sites and getting concerned with duplicate content - everything was being duplicated and the search engines (allegedly) look down on...

Martin, the owner of Milton Gems and Shop4Silver

More Testimonials »