Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-08-2014 04:39:21

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Rewriting non-www to www without breaking checkout etc

I'm trying to get .htaccess to redirect a request for http://affordable-leather.co.uk to http://www.affordable-leather.co.uk but using the code below both still come back as 200 rather than the non-www version coming back as 301

I can't simply check for not having a www because when you go to the shopping cart etc it looks for the address https://secure4.site-login.net/affordab … o.uk/ccp8/

I've tried using RewriteCond %{HTTP_HOST} !^secure    and   RewriteCond %{HTTP_HOST} !^https://secure4.site-login.net/affordable-leather.co.uk/ccp8/  but that hasn't helped.

NB the software is in the folder /ccp8 so  I also redirect all requests to http://www.affordable/leather.co.uk/ccp8/(whatever) but if I change the [L] to [R=301,l} then both www and non-www versions return a 301

Can someone please show me where I'm going wrong.

Code:

# Turn Rewite Engine On

Options +FollowSymLinks
RewriteEngine On

# Redirect non-www to www address 

RewriteCond %{HTTP_HOST} ^http://affordable-leather\.co\.uk
RewriteRule (.*) http://www.affordable-leather.co.uk/$1 [R=301,L]



# Redirect base url to go straight to ccp8 splash page: Moved from above Redirect non-www

RewriteRule ^$ /ccp8/ [L]


# Redirect /shop to /ccp8

RewriteRule ^shop/(.*) http://www.affordable-leather.co.uk/ccp8/$1 [L,R=301]


# Fix broken link for HAR 32 

RewriteRule ^item--(.*) http://www.affordable-leather.co.uk/ccp8/item--$1 [R=301,L]

# Fix broken links to xmod reviews

RewriteRule ^ccp8/ecom-xmodreviewsf/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/Item/$1 [R=301,L]

# Fix broken links to ecom-prodshow

RewriteRule ^ccp8/ecom-prodshow/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/Item/$1 [R=301,L]

# Fix broken links to email friend

RewriteRule ^ccp8/ecom-emailfriend/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/Item/$1 [R=301,L]



# ATS SEO 

RewriteRule ^([^/].+)/([^--].+)--(.+)\.html$ ccp8/index.php?app=ecom&ns=prodshow&ref=$3 [L,PT]
RewriteRule ^([^--].+)--(.+)\.htm$ ccp8/index.php?app=cms&ns=display&ref=$2 [L,PT]
RewriteRule ^([^--].+)--(.+)\.html$ ccp8/index.php?app=ecom&ns=catshow&ref=$2 [L,PT]
RewriteRule ^(.*)-(.*)/(.*)\.html ccp8/index.php?app=$1&ns=$2&ref=$3 [L,PT]

# Old SEO Rule Rewrites

RewriteRule ^ccp8/cat--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=catshow&ref=$2 [L,PT]
RewriteRule ^ccp8/item--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=prodshow&ref=$2 [L,PT]
RewriteRule ^ccp8/page--(.*)--(.*)\.html ccp8/index.php?app=cms&ns=display&ref=$2 [L,PT]
RewriteRule ^ccp8/store ccp8/index.php?app=ecom&ns=splash [L,PT]
RewriteRule ^ccp8/splash ccp8/index.php?app=cms&ns=display&ref=splash [L,PT]

# Version 8 Rewrite Rules

RewriteRule ^ccp8/index.php - [L,PT]
RewriteRule ^ccp8$ index.php?COREseourl=/ [L,PT]
RewriteRule ^ccp8/$ ccp8/index.php?COREseourl=/ [L,PT]
RewriteRule ^ccp8/sitemap\.xml ccp8/utilities/sitemap.xml [L,PT]
RewriteRule ^ccp8/rss\.xml ccp8/utilities/rss.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/ccp8/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ccp8/(.*) ccp8/index.php?COREseourl=/$1 [L,PT]

Offline

 

#2 05-08-2014 09:27:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

RewriteCond %{HTTP_HOST} ^http://affordable-leather\.co\.uk
RewriteCond %{SERVER_PORT} ^80$
RewriteRule (.*) http://www.affordable-leather.co.uk/$1 [R=301,L]


Nick Hendler

Offline

 

#3 05-08-2014 10:00:56

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Rewriting non-www to www without breaking checkout etc

Thanks, but I've just tried that and then checked with both http://www.ragepank.com/redirect-check/ and http://www.axandra.com/free-online-seo- … s-code.php and they both say that the non-www version is reporting a 200 code, rather than a 301:

http://affordable-leather.co.uk returns a 200 (OK) response. PR N/A
http://www.affordable-leather.co.uk returns a 200 (OK) response. PR N/A

200 OK http://affordable-leather.co.uk/

I'm worried that this is going to hit me for duplicate content, so I need to get it fixed.

Offline

 

#4 05-09-2014 09:30:20

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

I'm not sure why it's not working.  Try escaping the dash in the domain name to see if it matches:

RewriteCond %{HTTP_HOST} ^http://affordable\-leather\.co\.uk
RewriteCond %{SERVER_PORT} ^80$
RewriteRule (.*) http://www.affordable-leather.co.uk/$1 [R=301,L]


Nick Hendler

Offline

 

#5 05-09-2014 11:52:54

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Rewriting non-www to www without breaking checkout etc

Thanks for the suggestion, but that didn't work either :-(

Offline

 

#6 05-12-2014 05:36:34

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Rewriting non-www to www without breaking checkout etc

Ok, this is getting frustrating!

If I use the .htaccess code below it correctly redirects non-www urls to www but only at the expense of breaking the links to the checkout because it says it's redirecting in a way that will not complete.

I've tried checking for port 80, for not port 443 and for not "secure4.site-login.net/affordable-leather.co.uk" which is the link to the secure section when you go to the checkout etc, but none of that works.

If I take the section starting # Redirect non-www to www address  out then the link to the secure checkout etc works, but the site allows non-www urls.

Can anyone please suggest a solution so non-www urls will redirect properly without breaking anything else??

Code:

# Turn Rewite Engine On

Options +FollowSymLinks
RewriteEngine On

# Redirect non-www to www address 

RewriteCond %{HTTP_HOST} ^affordable-leather\.co\.uk
RewriteCond %{HTTP_HOST} !^www\.affordable-leather\.co\.uk
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{THE_REQUEST} !^secure4\.site-login\.net/affordable-leather\.co\.uk
RewriteRule (.*) http://www.affordable-leather.co.uk/$1 [R=301,L]




# Redirect /shop to /ccp8

RewriteRule ^shop/(.*) http://www.affordable-leather.co.uk/ccp8/$1 [L,R=301]

# ATS SEO 

RewriteRule ^([^/].+)/([^--].+)--(.+)\.html$ ccp8/index.php?app=ecom&ns=prodshow&ref=$3 [L,PT]
RewriteRule ^([^--].+)--(.+)\.htm$ ccp8/index.php?app=cms&ns=display&ref=$2 [L,PT]
RewriteRule ^([^--].+)--(.+)\.html$ ccp8/index.php?app=ecom&ns=catshow&ref=$2 [L,PT]
RewriteRule ^(.*)-(.*)/(.*)\.html ccp8/index.php?app=$1&ns=$2&ref=$3 [L,PT]

# Old SEO Rule Rewrites

RewriteRule ^ccp8/cat--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=catshow&ref=$2 [L,PT]
RewriteRule ^ccp8/item--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=prodshow&ref=$2 [L,PT]
RewriteRule ^ccp8/page--(.*)--(.*)\.html ccp8/index.php?app=cms&ns=display&ref=$2 [L,PT]
RewriteRule ^ccp8/store ccp8/index.php?app=ecom&ns=splash [L,PT]
RewriteRule ^ccp8/splash ccp8/index.php?app=cms&ns=display&ref=splash [L,PT]

# Version 8 Rewrite Rules

RewriteRule ^ccp8/index.php - [L,PT]
RewriteRule ^ccp8$ index.php?COREseourl=/ [L,PT]
RewriteRule ^ccp8/$ ccp8/index.php?COREseourl=/ [L,PT]
RewriteRule ^ccp8/sitemap\.xml ccp8/utilities/sitemap.xml [L,PT]
RewriteRule ^ccp8/rss\.xml ccp8/utilities/rss.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/ccp8/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ccp8/(.*) ccp8/index.php?COREseourl=/$1 [L,PT]





# Redirect Item to item and Category to category

RewriteRule ^ccp8/Item/(.*) http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]
RewriteRule ^ccp8/Category/(.*) http://www.affordable-leather.co.uk/ccp8/category/$1 [R=301,L]

# Fix broken link for HAR 32 

RewriteRule ^item--(.*) http://www.affordable-leather.co.uk/ccp8/item--$1 [R=301,L]

# Fix broken links to xmod reviews

RewriteRule ^ccp8/ecom-xmodreviewsf/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]

# Fix broken links to ecom-prodshow

RewriteRule ^ccp8/ecom-prodshow/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]

# Fix broken links to email friend

RewriteRule ^ccp8/ecom-emailfriend/(.*)\.html$ http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]

# Rewrite rule for links to /albums/

RewriteRule ^albums/ http://www.affordable-leather.co.uk/ccp8/ [R=301,L]

# Rewrite rule for links to latest

RewriteRule ^latest\.htm$ http://www.affordable-leather.co.uk/ccp8/news [R=301,L]

# Rewrite rule for link to main

RewriteRule ^main\.htm http://www.affordable-leather.co.uk/ccp8/ [R=301,L]

# Rewrite rule for link to strapons

RewriteRule ^Strap-Ons http://www.affordable-leather.co.uk/ccp8/category/Strap-On_Dildos [R=301,L]

Offline

 

#7 05-12-2014 10:34:04

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

Your problem is the use of 'secure4.site-login.net/affordable-leather.co.uk' for the URL.  Change the cert to 'www.affordable-leather.co.uk' and your .htaccess will work.


Nick Hendler

Offline

 

#8 05-12-2014 13:14:18

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Rewriting non-www to www without breaking checkout etc

This is a shared security certificate from our hosts.

Is there a way to get this to work or are you saying we will have to pay for our own certifcate?

Offline

 

#9 05-13-2014 13:41:47

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

Depends.  Ask your host if your .htaccess file will still be able to rewrite URLs when accessed via SSL.  If so, you might be able to fork SSL and Non-SSL logic in the .htaccess.


Nick Hendler

Offline

 

#10 08-20-2014 10:21:13

LiamEcoRuin
Member
Registered: 04-03-2014
Posts: 54

Re: Rewriting non-www to www without breaking checkout etc

I am having the opposite problem from this guy but am unsure how to go about it. My security certificate is for "ownajukebox.com" but all my links go to "www.ownajukebox.com". Is there a walk through I can follow to install the security certificate I have into my site? Then after is there any way to rewrite my .htaccess to make all my links pull up through https://ownajukebox.com? Many thanks.

Last edited by LiamEcoRuin (08-20-2014 10:21:26)

Offline

 

#11 08-20-2014 11:49:47

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

Re-run your software installer (installer.php) and edit the URLs accordingly.  That's all that's needed.


Nick Hendler

Offline

 

#12 08-21-2014 11:31:36

LiamEcoRuin
Member
Registered: 04-03-2014
Posts: 54

Re: Rewriting non-www to www without breaking checkout etc

webmaster wrote:

Re-run your software installer (installer.php) and edit the URLs accordingly.  That's all that's needed.

I did that and it works great... the second part of what I am asking is if there is edits I can make to my .htaccess sheet to convert all my links before checkout from wwwownajukebox.com/category (example with seo on and .htaccess configured the way it needs to be through the tutorial) to https://ownajukebox.com/category (my SSL certificate is for ownajukebox.com not wwwownajukebox.com) So I was wondering if there is any quick code I could add to my .htaccess that redirects the pages through the secure part of the site so that the entire site is secure even if your not logged in.

Offline

 

#13 08-21-2014 13:09:27

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Rewriting non-www to www without breaking checkout etc

Have a look at the core_namespaces table.
There is a column called hreftype that sets whether a namespace is secure or not.
Changing all the frontend namespaces to SSL from non-SSL should acheive what you want.

or maybe you could just change the core non ssl url through the installer to https.
Not sure if this would work.


Rob

Offline

 

#14 08-21-2014 14:46:49

LiamEcoRuin
Member
Registered: 04-03-2014
Posts: 54

Re: Rewriting non-www to www without breaking checkout etc

zanart wrote:

Have a look at the core_namespaces table.
There is a column called hreftype that sets whether a namespace is secure or not.
Changing all the frontend namespaces to SSL from non-SSL should acheive what you want.

or maybe you could just change the core non ssl url through the installer to https.
Not sure if this would work.

I will give it a shot by changing the namespaces... Furthermore is there any walkthrough to add canonical tags to the pages? I dont believe Kryptronic has the option to.

Offline

 

#15 08-21-2014 14:53:12

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Rewriting non-www to www without breaking checkout etc


Rob

Offline

 

#16 08-22-2014 10:32:48

LiamEcoRuin
Member
Registered: 04-03-2014
Posts: 54

Re: Rewriting non-www to www without breaking checkout etc

zanart wrote:

https://forum.kryptronic.com/viewtopic.php?id=31980

Post 5 provides the solution

Both answers you gave me work mint! The first one, you were correct. Changing it in the installer.php didnt work but changing the namespaces did. Also thank you so much for the canonical forum link. It helped a ton!

Offline

 

#17 09-02-2015 04:25:24

Malindo
Member
From: London
Registered: 01-13-2014
Posts: 79
Website

Re: Rewriting non-www to www without breaking checkout etc

Offline

 

#18 09-02-2015 07:05:22

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

RewriteRule ^ecom-prodshow/(.*)$  https://bikocartridges.com/$1 [L,R=301]


Nick Hendler

Offline

 

#19 09-03-2015 16:46:28

Malindo
Member
From: London
Registered: 01-13-2014
Posts: 79
Website

Re: Rewriting non-www to www without breaking checkout etc

Hi Nick,

I Couldn't get it work so I'm now using the default setting. Could you have a look on this as i'm now trying to change :
https://bikocartridges.com/Item/Kodak-8 … k-Ink-Gen4 TO: https://bikocartridges.com/Kodak-895591 … k-Ink-Gen4

Options +FollowSymLinks
RewriteEngine on

###
### Rewrite Non-HTTPS Requests
###

RewriteCond %{HTTP_HOST} ^https://bikocartridges\.com
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^Item/(.*)$  https://bikocartridges.com/$1 [L,R=301]

###

Offline

 

#20 09-04-2015 07:32:54

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

That rule is only rewriting https requests for URLs starting with /Item.  I don't think that's what you wanted to do.  Look at the single rule I gave you in post 18 and add as a single rule, after any http->https rewrites.


Nick Hendler

Offline

 

#21 09-06-2015 17:59:07

Malindo
Member
From: London
Registered: 01-13-2014
Posts: 79
Website

Re: Rewriting non-www to www without breaking checkout etc

Hi Nick,

All I need it is to change the links from: https://bikocartridges.com/Item/pg-540-cl-541-Multipack TO: https://bikocartridges.com/pg-540-cl-541-Multipack.
I've tried the post 18 but it no working so what should I do next?

Thanks

Malindo

Offline

 

#22 09-07-2015 07:01:00

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

Code:

RewriteRule ^Item/(.*)  https://bikocartridges.com/$1 [L,R=301]

Nick Hendler

Offline

 

#23 09-10-2015 11:50:41

Malindo
Member
From: London
Registered: 01-13-2014
Posts: 79
Website

Re: Rewriting non-www to www without breaking checkout etc

Hi Nick,

Thank you for your response the change was made , There is not changes is there any thing Ineed to know about the setting?

Malindo

Offline

 

#24 09-11-2015 07:58:33

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Rewriting non-www to www without breaking checkout etc

Jeff consulted me concerning a Fresh Eyes Analysis he's working on for your site.  Before you make any more changes, ensure you go through your report and look at all the comments regarding SEO.  I know you're trying to get things working the way you want them, but the changes you're making are all over the place and really hurting your SEO.  Before you do anything further, read the report and get back in touch with Jeff.  I really want to work with you on straightening out your SEO via a custom shop job.  You've made many conflicting changes, have basically blown away your homepage and have multiple levels of redirects that conflict with each other.


Nick Hendler

Offline

 

#25 09-11-2015 14:52:27

Malindo
Member
From: London
Registered: 01-13-2014
Posts: 79
Website

Re: Rewriting non-www to www without breaking checkout etc

OK THANKS NICK

i'LL GET IN TOUCH WITH THEM AND SORT OUT EVERYTHING

Malindo

Offline

 

Board footer