Jump to content

 

pjlee

Member Since 20 Jan 2012
Offline Last Active Jun 22 2013 11:50 AM
-----

Topics I've Started

Redirect index.php and / and non / to .html version of urls

22 May 2013 - 09:26 AM

Hi,

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?

Visitor Tracking Stopped Logging Visitors

11 May 2013 - 08:26 AM

Hi,

I need a little expert help. I am using CS Cart version 2.2.4 and about a week ago my visitor tracking stopped logging visitors to the site but strangely still tracks robots ( please see screen shot).

The site has definitely had visitors as we have made sales over this period.

Any ideas?

.htaccess 301 Redirect non slash domains and slash domain to .html

03 May 2013 - 09:45 AM

I am trying to add some code to my .htaccess to redirect all slash and non slash urls ( apart from my homepage ) to the .html url.

For example
www.mydomain.com/cat/
www.mydomain.com/cat

should redirect to

www.mydomain.com/cat.html

I have managed to add the following to my .htaccess which redirects www.mydomain.com/cat to the right place www.mydomain.com/cat.html but need some help on how to make slash version redirect to the .html page

RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ [url="http://mydomain.com/$1.html"]http://mydomain.com/$1.html[/url] [R=301,L]


My whole .htaccess looks like this, if anyone has any suggestions on how it should look in light of the above it would be greatly appreciated.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xxx.xxx.xxx.xx [nc,or]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ [url="http://www.mydomain.com/$1"]http://www.mydomain.com/$1[/url] [L,R=301]

RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]


RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ [url="http://mydomain.com/$1.html"]http://mydomain.com/$1.html[/url] [R=301,L]


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 [url="http://www.yourcompany.com/store/cart"]http://www.yourcompany.com/store/cart[/url]
# 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>

Many thanks in advance.

Fasthosts Internal Server Error when adding products via XML addon

20 September 2012 - 01:50 PM

Hi,

I have a custom addon created by CS Cart that add's products to my site via XML feed. CS cart have verified the addon to be working on their server. The import process inevitably takes a long time due to our large product base, but at present when I run ether of the XML feed's the import process seems to be terminated by the server software (Error 500 Internal Server Error). I currently use a fasthosts dedicated server to host my site which seems to be causing my problem


I contacted fasthosts who state that the issue is out of their scope of support.

My skills are very basic, but if anyone can let me know how to fix the problem or if you could assist me it would be hugely appreciated.