Miva Merchant SEO, eCommerce, Miva Modules, Custom Web Apps, and Miva Merchant troubleshooting.
miva certified developers

Miva Merchant & Miva Script News

Here's the basic htaccess code to force a WWW into the URL. It also optionally redirects to the HTTPS version of the url.

Miva Merchant, Website Tips & Tricks

One of my clients recently asked me to make it so the URL forces to WWW and HTTPS. Hope this helps!

RewriteEngine on
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

Basically, the WWW redirect checks to see if there's a WWW in the URL and adds it if it isn't, then it checks to see whether the URL is secure or not and redirects to the HTTPS URL if not.

Both of these rules are discussed on Stack Overflow, a great forum with a lot of answers about common (and a lot of uncommon) issues developers run into. 

The WWW section of the htaccess code above comes from: http://stackoverflow.com/a/495...

The SSL section comes from: http://stackoverflow.com/q/243...

Note: turn off the SSL redirect by removing the lines under # SSL/HTTPS

overall rating:
my rating: log in to rate


Please log in to leave a comment.

The blog posts on Scot's Scripts are served by Scot's Blogger, a Miva Merchant blogging module that makes it easy to create a Wordpress style blog, rich content, and extra pages in your Miva Merchant store.