Doug Fir
Doug Fir

Reputation: 21302

Redirects in .htaccess

I am trying to redirect 4 URL variations to one "canonical" URL. The "canonical" version (I'm not sure I'm using the word canonical correctly) is:

http://example.com

These 3 variants should point to that URL

http://www.example.com https:example.com https://www.example.com

I have them all working bar one. https://www.example.com does not redirect.

I have a developer account where domains are served with applications. The domain http://www.example.com is served with the following .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

And it works.

The domains https://example.com and https://www.example.com are served with the following .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

In this instance it works for https://example.com, which redirects to the non ssl non www version. The domain https://www.example.com does not though. I'm not to savvy on .htacces can anyone point out what to add?

Upvotes: 0

Views: 50

Answers (1)

Jon Lin
Jon Lin

Reputation: 143946

Make sure that the htaccess file is also in the document root of the www.example.com SSL domain. Otherwise your rules are fine.

Upvotes: 1

Related Questions