Post by askural » Thu Jan 11, 2018 11:43 pm

After changing into https and adding the following code to the .htaccess file:

RewriteCond %{HTTP_HOST} domainname\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domainname.com/$1 [R,L]
I get a 'SytaxError:Unexpected end of JASON input error' when I want to edit an order.

When I revert to:

#RewriteCond %{HTTP_HOST} domainname\.com [NC]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://www.domainname.com/$1 [R,L]
the error goes away and I can edit. But in this case, the website is not secure anymore and an unsafe sign appears at the top left side of the browser next to the address section.

I want to keep the site at https and still edit the orders. Can anyone help? Thank you...!

???

Newbie

Posts

Joined
Wed Jan 14, 2015 1:21 am

Post by OSWorX » Fri Jan 12, 2018 4:28 am

You do not post the most important thing: what OpenCart version you are using.
So what shall we do - take a look into a scry?
But I guess some lower than 2.3.x - correct?

Image


User avatar
Expert Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by askural » Fri Jan 12, 2018 4:45 am

Hello,
Sorry for my late reply.
OpenCart 2.0.1.1 Turkish version.
Thank you,
... :-X

Newbie

Posts

Joined
Wed Jan 14, 2015 1:21 am

Post by OSWorX » Fri Jan 12, 2018 6:12 am

What I thought.
Use this here: Admin Order Edit HTTPS-Fix

Image


User avatar
Expert Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by MrPhil » Sat Jan 13, 2018 6:42 am

I don't know if it has anything to do with the reported error, but I do see a couple of problems in your code:

Code: Select all

 RewriteCond  {HTTP_HOST} domainname\.com [NC]
 RewriteCond %{SERVER_PORT} 80
 RewriteRule ^(.*)$ https://www.domainname.com/$1 [R,L]
1) You are testing for a missing www. in the domain (host name) AND that http is being used (no SSL). You need to test these separately. The easiest way would be to add an OR flag on the first line: [NC,OR]. That will trigger the rewrite if it's missing www. OR it's http.
2) The R flag in the rewrite defaults to 302, which is a temporary move. You should be using [R=301,L] to signal a permanent move.

Check your configuration files that you are using www.domainname.com and https everywhere in them -- you shouldn't be relying on .htaccess to rewrite incorrect URLs. You should supply correct URLs in your configuration.

Is that JASON or JSON in the error message?

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm
Who is online

Users browsing this forum: No registered users and 10 guests