how to redirect http > https ~AND~ www > naked domain

Hello, Experts!  We want to redirect ALL traffic to https://ourdomain.com - whether it's http://ourdomain.com OR http://www.ourdomain.com.  Here is our current .htaccess file, hosted at GoDaddy's WordPress Managed Hosting:

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^ourdomain\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase //
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . //index.php [L]
</IfModule>
# END WordPress

++++++++++++++++++
So...  can someone tell me which lines to add / modify in order to accomplish our objective?  Thanks so much!! ~ Scott
Harrison WalkerAsked:
Who is Participating?
 
bigeven2002Commented:
Hello,
For the upper portion, comment out what you have, and try the following:
# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com 
RewriteRule ^(.*)$ http://domain.com/$1 [R=permanent,L] 
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL

Open in new window


You might have to clear your browser cache before it takes effect.
0
 
Harrison WalkerAuthor Commented:
Worked flawlessly!  Thanks for being an Expert!!  :)
0
 
bigeven2002Commented:
Glad I could help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.