Newbie needs help with cs-cart rewrite rules

New to mod_rewrite? This is a good place to start.

Newbie needs help with cs-cart rewrite rules

Postby mattinertia » Tue May 05, 2009 7:12 am

Hi guys (ive tried to post this in the newbie section but it wont let me so feel free to move it).

Im an SEO/Online marketer. One of my clients recently updated their ecommerce system to CS-Cart. On first inspection it seemed fine for SEO and it ticked many of the boxes. But today I've run into my first problem. When trying to redirect some old URLs I keep getting this:

Code: Select all
?sef_rewrite=1


...added to the end of my URLs. Here's the htaccess file as it came with CS-Cart:

Code: Select all
DirectoryIndex index.html index.php

<IfModule mod_rewrite.c>
RewriteEngine on

# Some hostings require RewriteBase to be uncommented
# Example:
# Your store url is http://www.yourcompany.com/store/cscart
# So "RewriteBase" should be:
# RewriteBase /store/cscart

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]

</IfModule>


So that rule is adding the extra characters to my urls. As a modrewrite newbie i dont have any idea how or why, or how i can get rid of it? Any help.

The redirects which i was attempting were standard mod_alias stuff. :(
mattinertia
 
Posts: 2
Joined: Tue May 05, 2009 6:37 am
Location: UK

Postby richardk » Tue May 05, 2009 11:14 am

Redirect with mod_rewrite instead
Code: Select all
DirectoryIndex index.html index.php
Options +FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine on

  # /abc.html to /def.html
  RewriteRule ^abc.html$ /def.html [R=301,L]

  # /abc and /abc/ to /def
  RewriteRule ^abc/?$ /def [R=301,L]

  # /ghi, /ghi/ and /ghi/* to /jkl
  RewriteRule ^ghi(/(.*))?$ /jkl/$2 [R=301,L]

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule . ./index.php?sef_rewrite=1 [QSA,L]
</IfModule>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mattinertia » Wed May 06, 2009 3:09 am

Cheers Richard that's worked well!
mattinertia
 
Posts: 2
Joined: Tue May 05, 2009 6:37 am
Location: UK


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 20 guests

cron