Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've searched far and wide for a solution to this and I am sure it's simple but I simply couldn't find a solution.

This is the regular wordpress redirect code:

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

How do I make it so that this will always route the url request to https://?

Note: The reason this is posted here and not on any other SO site is that I thought there might be a catch when it comes to WP.

BTW, I put the same question on ServerFault and got a big On Hold because "I did not try to solve this myself".

share|improve this question

closed as off-topic by Denis, toscho Nov 13 '13 at 8:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should be specific to WordPress within defined scope (merely happening in its context, such as generic PHP/JS/HTML/CSS, is insufficient). Might be better asked at Stack Overflow or other appropriate site of Stack Exchange network." – toscho
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Search on Stack Overflow. It would be closed as duplicate there, that’s why haven’t migrated it. –  toscho Nov 13 '13 at 10:49
    
@toscho I searched SO I couldn't find anything that explains what Denis explained. All I could find were how to move http to https when talking about the root domain not a different url and not something that already contains a RewriteRule. –  hitautodestruct Nov 13 '13 at 10:51

1 Answer 1

up vote 2 down vote accepted

This really belongs on ServerFault, StackOverflow or Webmasters...

But basically, you need to add something along these lines before the WP rules begin:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
share|improve this answer
    
Thank you very much for this! I tried on server fault and got put on hold.. I wasn't sure if this needed something special because it's wordpress. –  hitautodestruct Nov 13 '13 at 10:14
    
I've implemented your solution and I am getting "too many redirects" –  SkyHiRider Apr 14 at 0:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.