I was encountering problems with my visitor tracking, it had stopped logging visitors. I emailed CS cart and they recommended I removed the following code from my htaccess:
RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ /$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^(.+)/$ RewriteRule ^(.+)/$ /$1 [R=301,L] RewriteCond %{REQUEST_URI} !\.[^./]+$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://mysite.co.uk/$1.html
Removing the suggested code has fixed the tracking issue but has created another problem.
This part of the code did 2 things:
1. Redirected urls with a /( forward slash) and non / (forward slash) to the .html version for the url , for example:
http://www.mysite.co.uk/cat1
and
http://www.mysite.co.uk/cat1/
redirected to
http://www.mysite.co.uk/cat1.html
2. Redirected http://www.mysite.co.uk/index.php to http://www.mysite.co.uk/ (same page with different urls)
Both of these things have stopped working since removing the suggested code. My htaccess now looks like this:
Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^XXX.XXX.XXX.XX [nc,or] RewriteCond %{HTTP_HOST} ^mysite.co.uk [NC] RewriteRule ^(.*)$ http://www.mysite.co.uk/$1 [L,R=301] DirectoryIndex index.html index.php <IfModule mod_rewrite.c> RewriteEngine on # Pleas note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon. # Some hostings require RewriteBase to be uncommented # Example: # Your store url is http://www.yourcompany.com/store/cart # So "RewriteBase" should be: # RewriteBase /store/cart # RewriteBase / RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php?sef_rewrite=1 [L,QSA] </IfModule>
Please can someone recommend what to add to my htaccess to achieve the redirects and keep visitor tracking?