Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

301 Redirect for osCsid


ai12

Recommended Posts

My website has various 301 redirects set and my .htaccess file is setup using the one included in SEO URLS 5.

 

When I go to mywebsite.com/product_info.php?products_id=122, the 301 correctly redirects me to mywebsite.com/product-name.html. However for some reason if the osCsid parameter is in the URL, the 301 redirect fails to work. For example if I was to go to mywebsite.com/product_info.php?products_id=128?osCsid=pse9sdhrdhdy5ygjcdqo7tt6 or mywebsite.com/create_account.php?osCsid=msgratfga35tr3564h17advd41, the 301 redirect would fail to redirect to the correct URL.

 

Not sure why this is happening but if you look a my .htaccess file below it looks like it should cover the osCsid parameter.

 

# If you are getting errors you may need to comment this out like ..
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch

RewriteEngine On

# RewriteBase instructions
# Change RewriteBase dependent on how your shop is accessed as below.
# http://www.mysite.com = RewriteBase /
# http://www.mysite.com/catalog/ = RewriteBase /catalog/
# http://www.mysite.com/catalog/shop/ = RewriteBase /catalog/shop/

# Change RewriteBase using the instructions above
RewriteBase /
RewriteRule ^([a-z0-9/-]+)-p-([0-9]+).html$ product_info.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-c-([0-9_]+).html$ index.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-m-([0-9]+).html$ index.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-pi-([0-9]+).html$ popup_image.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-pr-([0-9]+).html$ product_reviews.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-pri-([0-9]+).html$ product_reviews_info.php [NC,L,QSA]
# Articles contribution
RewriteRule ^([a-z0-9/-]+)-t-([0-9_]+).html$ articles.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-au-([0-9]+).html$ articles.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-a-([0-9]+).html$ article_info.php [NC,L,QSA]
# Information pages
RewriteRule ^([a-z0-9/-]+)-i-([0-9]+).html$ information.php [NC,L,QSA]
# Links contribution
RewriteRule ^([a-z0-9/-]+)-links-([0-9_]+).html$ links.php [NC,L,QSA]
# Newsdesk contribution
RewriteRule ^([a-z0-9/-]+)-n-([0-9]+).html$ newsdesk_info.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-nc-([0-9]+).html$ newsdesk_index.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-nri-([0-9]+).html$ newsdesk_reviews_info.php [NC,L,QSA]
RewriteRule ^([a-z0-9/-]+)-nra-([0-9]+).html$ newsdesk_reviews_article.php [NC,L,QSA]

 

Thanks, Chris

Link to comment
Share on other sites

mywebsite.com/product_info.php?products_id=122, the 301 correctly redirects me to mywebsite.com/product-name.html

Actually, that's backwards. Given the non-SEO version (with query string), .htaccess will not match it and will do nothing to the URL and just pass it on. The .html (SEO) version will be rewritten to the non-SEO query string version, which gets you to the same place. Also, you're not doing a 301 redirection (where search engines are told to use the rewritten URL). You're doing a silent URL rewrite, so the changed URL should not be seen on the browser address line. Are you talking about other 301s not shown in your post? Sometimes multiple 301s can conflict with each other.

 

I'm not sure off the top of my head why the osCid is being discarded. The QSA flag should take any Query String from the incoming URL and combine it with any Query String from the rewritten URL. Come to think of it, is this the standard SEO URLS .htaccess, or did you modify it? I don't see where $2 (e.g., the product number 122) gets fed to (for example) product_info.php as a Query String term (?products_id=122).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...