Question

Redirect HTTP to HTTPS while including subdirectory/file

  • Posted on January 26, 2015
  • TIXAsked by TIX

I am having trouble redirecting http://tix.kiwi/atd (or any folder/file) to https://tix.kiwi/atd. It appears to redirect to https://tix.kiwiatd instead - which of course isn’t even a valid domain.

This is the code I’m using:

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^tix\.kiwi [NC]
 RewriteCond %{HTTPS} off
 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}

I’ve restarted apache, and I’ve also tried to look at my apache error log, but nothing shows up when logging is enabled via:

 LogLevel alert rewrite:trace8
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @sierracircle:

Try this in your .htaccess instead:

#force https 
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

View the original comment