SSL + www .htaccess

I’ve tried following a few stackoverflow code snippets to redirect my site to www. AND have https

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

This is my current rule (domain swapped out for my client site name). I get The page isn’t redirecting properly in my browser.

This is what I use

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.org$
RewriteRule .? http://www.domain.org%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.domain.org%{REQUEST_URI} [R,L]
1 Like

Weird. This is my script.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.gooseneckgripper\.com$
RewriteRule .? http://www.gooseneckgripper.com%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.gooseneckgripper.com%{REQUEST_URI} [R,L]

And this is my domain.
gooseneckgripper.com

Still getting redirect issues…Am I on a different port maybe?

1 Like

Odd! Your SSL certificate is working, is it?

I doubt you’d be on a different port.

Ah, it looks as though you’re running a LiteSpeed server. Does it use .htaccess the same way as Apache?

I believe so. If I use a SSL only mod_rewrite script, it does indeed redirect to https. It’s only when I try to add www. support that this flakes on me.

when trying to set the correct htaccess use the 302 temporary redirection because once a permanent 301 redirect is set it is remarkably difficult to change.

Try this for testing redirection:

http://supiet2.tk/

Turns out my wordpress installation was conflicting with these rules. Should be all set now :). Thanks everyone.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.