Jump to content

Recommended Posts

Posted (edited)

I updated from 6.1.9 to 6.1.10 and my website isn't redirecting directknifesales.com to www.directknifesales.com. How can this be done? I have been seeing something with the .htaccess file but everything I try doesn't seem to work. do you know what the coding is to make it work?

Edited by slic535

Posted

CubeCart's upgrade procedure replaces files with new files if those new files exist. So, the .htaccess file if it already existed, should not have been overwritten with files from the CC6110 package.

Which means if the redirect via .htaccess doesn't happen with CC6110, then the redirect via .htaccess was not being done in CC619 either.

Which means if there was a redirect happening, it was being managed by some other process.

Whatever, Stack Overflow has a few good suggestions for the .htaccess file (if your hosting account uses a web server that respects .htaccess directives).
https://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess

Posted

Sorry, but if the best suggestions put forward in that discussion isn't doing what is supposed to happen, then maybe something else is interfering.

What statements did you choose to add to the .htaccess file?

Posted

thank you for trying. I will have to submit a ticket and see what can be done.

 

I tried this and it didn't work

RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$

I chose everything on the page and tried it. nothing had any effect and if it did it doubled the www.name.comwww.name.com. I think it has to do with the coding in the file and a file in the admin htaccess file that restricts it but I don't know because I am not fluent on the php.

Posted

I switched from php 5.4 to 5.6. would that have something to do with it?

if you got it to work where did you put the coding?

##### START CubeCart .htaccess #####
## File Security
<FilesMatch "\.(htaccess)$">
 Order Allow,Deny
 Deny from all
</FilesMatch>
#### Apache directory listing rules ####
DirectoryIndex index.php index.htm index.html
IndexIgnore *
#### Rewrite rules for SEO functionality ####
<IfModule mod_rewrite.c>
  RewriteEngine On
    RewriteBase /
 
  ######## START v4 SEO URL BACKWARD COMPATIBILITY ########
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule cat_([0-9]+)(\.[a-z]{3,4})?(.*)$ index.php?_a=category&cat_id=$1&%1 [NC]
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule prod_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule info_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=document&doc_id=$1&%1 [NC]
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule tell_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule _saleItems(\.[a-z]+)?(\?.*)?$ index.php?_a=saleitems&%1 [NC,L]
  ######## END v4 SEO URL BACKWARD COMPATIBILITY ########
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
  RewriteRule ^(.*)\.html?$ index.php?seo_path=$1 [L,QSA]
</IfModule>
## Default store 404 page
ErrorDocument 404 /index.php
##### END CubeCart .htaccess #####
<FilesMatch "\.(gif|jpe?g|png|ico|css|js|svg)$">
  ErrorDocument 404 "<html></html>
</FilesMatch>
##### END CubeCart .htaccess #####
Posted (edited)

Well, it's not redirecting now so you have changed something.

Try adding

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com

RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

below

IndexIgnore *

I've edited this to remove the https

Edited by ayz1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...