[FX.php List] [OFF] Rewrite for forcing http to https possible?

Troy Meyers tcmeyers at troymeyers.com
Wed Sep 17 15:29:30 MDT 2008


David,

I haven't looked at the files you attached yet, but only because I do think the one modification to httpd.conf did do the trick, I just flummoxed myself into thinking it hadn't. I will look at these files to see what I can learn, though.

In the mean time, I changed my root-level .htaccess file to what your second suggestion was:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

... and sure enough, initial testing does infact do the rewrite so that if I put in the browser:
http://192.168.1.105/phpinfo.php
...it's immediately redirected to:
https://192.168.1.105/phpinfo.php

Other files in that directory level also work similarly. Next I'll try files in deeper folders, and also see if it work if directory names work, instead of just file names.

I'm feeling very hopeful, thank you so much.

My final step, I think, is to integrate this with the existing .htaccess I'm using on the current non-SSL-only machine, the one that does the Blackbelt rewrites.

Would you think I'd just put this set of commands first?

-Troy



> OK, attached is my httpd.conf, my user conf (dlw.conf) and a sample
> showing that mod_rewrite works. There's an .htaccess file in the rewrite
> folder that won't show up in the finder but will by going to the folder
> in Terminal and doing an ls -al.
> 
> I also did a chown www:www on the .htaccess file which I think made a
> difference, but can't be sure 100%.
> 
> Looking at the Console.app and the Apache logs will show you Apache
> errors and if Apache fails to start up you will actually not know just
> by looking the the Web sharing checkbox (!!) but the logs will tell you.
> 
> Let me know how it goes,
> 
> David



More information about the FX.php_List mailing list