slic535 Posted September 14, 2017 Posted September 14, 2017 (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 September 14, 2017 by slic535 Quote
bsmither Posted September 14, 2017 Posted September 14, 2017 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 Quote
slic535 Posted September 14, 2017 Author Posted September 14, 2017 I tried every link that was on the page and nothing worked. any ideas? Quote
bsmither Posted September 14, 2017 Posted September 14, 2017 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? Quote
keat Posted September 14, 2017 Posted September 14, 2017 Try this RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ Quote
slic535 Posted September 14, 2017 Author Posted September 14, 2017 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. Quote
ayz1 Posted September 14, 2017 Posted September 14, 2017 I've just tried it and directknifesales.com is redirecting to www.directknifesales.com Quote
slic535 Posted September 14, 2017 Author Posted September 14, 2017 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 ##### Quote
ayz1 Posted September 14, 2017 Posted September 14, 2017 (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 September 14, 2017 by ayz1 Quote
slic535 Posted September 14, 2017 Author Posted September 14, 2017 still nothing. I left the coding in it to see if you see something else Quote
ayz1 Posted September 14, 2017 Posted September 14, 2017 Still some strange behaviour. Can you check the code you have added and make sure you change the https to http RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L] Quote
slic535 Posted September 14, 2017 Author Posted September 14, 2017 when I look at the .com it shows .com but when I touch the address bar it changes to http://www. I never noticed it change. Ok is it working now! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.