Forum Moderators: phranque

Message Too Old, No Replies

osCommerce 301 a single page

301 a single page

         

whyyi

9:58 pm on May 7, 2009 (gmt 0)

10+ Year Member



Does anyone know how to 301 a single page with osCommerce? The usual code doesn't seem to be working.

redirect 301 /old.htm [site.com...]

The page will redirect but I get this added to the end of the url: ?cPath=50

Any help is greatly appreciated.

g1smd

11:02 pm on May 7, 2009 (gmt 0)

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



You need to use RewriteRule instead.

You'll need the [R=301,L] flags.

The target URL in the rule has to have a question mark appended if you want to suppress parameters from being re-appended.

If the requested URL contains parameters, you might also need to look at QUERY_STRING by using a preceding RewriteCond as well.

whyyi

12:34 am on May 8, 2009 (gmt 0)

10+ Year Member



thanks for replying so quickly. Sorry kind of a newbie but this is what i came up with and it doesn't seem to be working:

RewriteCond %{QUERY_STRING} cPath=50
RewriteRule /teak-wood-furniture-c50/ [maxoutdoorliving.com...] [R=301,L]

Old - [testsite.com...]

New (trying to redirect) - [testsite.com...]

Any ideas?

g1smd

7:28 am on May 8, 2009 (gmt 0)

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



RewriteRule, when used in .htaccess, cannot "see" the leading slash on the requested URL. So change
/t
to
^t
in the pattern.

jdMorgan

1:48 pm on May 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, I recommend that you anchor your patterns to prevent unexpected matches, for example, on "cPath=500" or on "/teak-wood-furniture-c50/blah" :

# Remove query string from specific requested URL-path
RewriteCond %{QUERY_STRING} &?cPath=50&?
RewriteRule ^teak-wood-furniture-c50/$ http://www.example.com/teak-wood-furniture-c50/? [R=301,L]

Jim

whyyi

3:49 pm on May 8, 2009 (gmt 0)

10+ Year Member



Guys, THANK YOU IT WORKED! You saved me hours and hours of work and researching.

Here's the final code:

RewriteCond %{QUERY_STRING} &?cPath=50&?
RewriteRule ^teak-wood-furniture-c50/$ http://www.example.com/teak-wood-furniture-c50/? [R=301,L]

Thank you so much!