Report this

What is the reason for this report?

Redirect HTTP to HTTPS while including subdirectory/file

Posted on January 26, 2015
WTPX

By WTPX

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


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!

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.