Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 ASP (Windows server) versions
 Cart URL Changes - Newsletter
Author « Topic »  

Paradise
Ecommerce Template Guru

USA
1602 Posts

Pre-sales questions only
(More Details...)

Posted - 03/12/2020 :  16:28:44  
I did the test and I do lose the cart contents when I remove the www. from the URL.

What do I need to add to the web.config file to fix this issue?

Mark

Mark
Responsive Design Deals Ecomm Plus - ASP 6.8
www.paradiseclothingco.com

insight
ECT Moderator

USA
4479 Posts

Posted - 03/12/2020 :  19:10:42  
Nothing, ask your host to do it, they can make a tidier job of it by doing the redirect further up the food chain

Peter


Professional ecommerce web hosting services
Shared hosting Windows & Linux | Dedicated servers | Domains | SSL
Ecommerce Templates specialists since 2003
https://servelink.com

Vince
Administrator

42756 Posts

Posted - 03/13/2020 :  01:06:13  
Hi Mark
If you do wish to do this yourself however, add these rules to your web.config file changing yourstoreurl.com for your actual store URL of course...
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.yourstoreurl\.com$" negate="true" />
</conditions>
<action type="Redirect" url="https://www.yourstoreurl.com/{R:1}" redirectType="Permanent" />
</rule>
<rule name="Force HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://www.yourstoreurl.com/{R:1}" redirectType="Permanent" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


Take a backup of your web.config before doing this as any errors adding these entries can make your site inaccessible.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

Joe-Mama
Starting Member

3 Posts

Pre-sales questions only
(More Details...)

Posted - 03/14/2022 :  13:39:29  
I'm having a similar issue. What would be the PHP fix to the ASP solution that Vince posted?
-Joe

Vince
Administrator

42756 Posts

Posted - 03/15/2022 :  03:42:00  
Hi Joe
This will force both HTTPS and www. if you add it to your .htaccess file...

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^yourstore\.com [NC]
RewriteRule (.*) https://www.yourstore.com/$1 [L,R=301]

If you don't want to force HTTPS then it would be like this...

RewriteCond %{HTTP_HOST} ^yourstore\.com [NC]
RewriteRule (.*) http://www.yourstore.com/$1 [L,R=301]

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000