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

Troy Meyers tcmeyers at troymeyers.com
Wed Sep 17 15:13:36 MDT 2008


David,

I take it all back... perhaps it is working now. I feel like a dunce if it is, the "rewrite.php" has two links for testing, and I probably clicked the wrong one. I now get a "Congratulations!! You are using Apache mod_rewrite" page if I click the 2nd link.

I'm happy enough being a dunce if it all works. :P

Now I'll give the http: to https: stuff a whirl. Thanks again, and keep your fingers crossed for me.

-Troy



Earlier, maybe erroneously, I wrote:

David,

No-go, I guess. I assumed you meant the main /private/etc/apache2/httpd.conf file. I used sudo pico to edit the line you indicated from AllowOverride None to AllowOverride All. This is the instance wrapped inside the lines:
<Directory "/Library/WebServer/Documents">
....
</Directory>

I restarted Apache (two ways, once from Terminal and again once with the checkbox in Sharing) and the  "rewrite.php" test that I used before (with refresh, etc.) still indicates that it's not working. But can I trust that test?

Arrg, I've lost track of the apache log files. I viewed them before when I was first getting SSL to work, but now I can't recall nor find them.

-Troy


> Hi Troy,
> 
> I was able to get it working by changing AllowOverride None to All in
> the second instance of the entry where it's enabling it in the .htaccess
> file.
> 
> Look for the section of commented out text that reads:
> 
>    # AllowOverride controls what directives may be placed in .htaccess
> files.
> 
>    # It can be "All", "None", or any combination of the keywords:
> 
>    #   Options FileInfo AuthConfig Limit
> 
> Let me know if that works for you,
> 
> David
> 
On Wed, Sep 17, 2008 at 12:00 PM, biscuit technologies
<biscuit.tech at gmail.com> wrote:
> Hi Troy,
> On my server the .htaccess file is owned by www:www (user:group) and
> the permissions are -rw-r--r-- which I believe translates to 644.
>
> In my experience a wrongly formatted htaccess file or one with wrong
> permissions will result in an error instead of failing silently.
>
> Have you looked through the logs to see if there's anything related
> being reported?
>
> I have Leopard installed on a different computer - send me the
> contents of your current htaccess file and I'll give it a try here.
>
> - David
>
> On Wed, Sep 17, 2008 at 10:45 AM, Troy Meyers <tcmeyers at troymeyers.com> wrote:
>> David,
>>
>> I forgot to mention that after that try was fruitless, it occurred to me that mod_rewrite might actually be enabled, but that due to some aspect of the .htaccess file, it wasn't readable or usable. I looked at the permissions, and tried some variations using chmod, but still no luck.
>>
>> Could there be some aspect of the .htaccess file that needs to be corrected? What are the proper permissions and ownership? Any special encoding or format needed?
>>
>> -Troy
>>
>>
>>> Hi Troy,
>>>
>>> I curious to know if you've got this solved and if so, how?
>>>
>>> - David
>>
>>
>> On Thu, Sep 11, 2008 at 9:18 PM, biscuit technologies
>> <biscuit.tech at gmail.com> wrote:
>>> Hi troy,
>>> according to this:
>>> http://michaelkrol.com/2007/10/30/local-web-development-with-os-x-105-leopard/
>>> mod_rewrite is on by default in leopard's apache 2.2
>>> apache 2 is quite a bit different from previous versions in some ways and
>>> I'm not that familiar with it, but I think this thread on the apple
>>> discussions site is pretty thorough:
>>> http://discussions.apple.com/thread.jspa?threadID=1453778&tstart=8
>>> maybe that will help,
>>> David
>>> On Thu, Sep 11, 2008 at 5:20 PM, Troy Meyers <tcmeyers at troymeyers.com>
>>> wrote:
>>>>
>>>> David,
>>>>
>>>> I'm using the Apache 2.2 as comes with Leopard, and I've added the Entropy
>>>> PHP 5.5 (Release 6) which is working (phpinfo works).
>>>>
>>>> The directory that httpd.conf is slightly different in this installation,
>>>> it's
>>>> /private/etc/apache2/httpd.conf
>>>> But no matter, that's to be expected.
>>>>
>>>> Searching for "mod_rewrite" in httpd.conf all I found is:
>>>> LoadModule rewrite_module libexec/apache2/mod_rewrite.so
>>>> which is not commented out... but that's the only thing I found.
>>>>
>>>>
>>>>
>>>> Looking at the httpd.conf file in the other older Apache (1.3) server
>>>> that's in use instead of testing, I find these things:
>>>>
>>>> LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
>>>> ....
>>>> AddModule mod_rewrite.c
>>>> .....
>>>> <IfModule mod_rewrite.c>
>>>>    RewriteEngine On
>>>>    RewriteCond %{REQUEST_METHOD} ^TRACE
>>>>    RewriteRule .* - [F]
>>>> </IfModule>
>>>>
>>>>
>>>>
>>>> Going back to the Apache 2.2 one which is the subject of my problem, I
>>>> looked for any instance of "AddModule" in the httpd.conf file, and there
>>>> aren't any. It seems like 2.2 must work differently, because the 1.3 has
>>>> tons of them. So I guess that's not the problem.
>>>>
>>>> I don't know. I guess I'll Google more to see if I can find instructions
>>>> on how to turn this on for Apache 2.2, because if the test was correct, it
>>>> isn't.
>>>>
>>>> Thanks.
>>>>
>>>> -Troy
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> > There's a couple of things to look into. I'm on 10.4.11 and using
>>>> > entropy's php, so you might have some differences, but this is what I
>>>> > just did. go to /etc/httpd/httpd.conf using your preferred text editor
>>>> > (for simplicity sake I used nano) and do a find (cntl-w, ("where")) for
>>>> > mod_rewrite and check that it isn't commented out. Mine was fine.
>>>> >
>>>> > upload the rewrite test to your /Library/Webserver/Documents folder
>>>> > with the sample php file and sample .htaccess file and if needed do a
>>>> > sudo apachectl restart graceful and give it a try. on my little mini it
>>>> > seems to work ok.
>>>> >
>>>> > if you are accessing a user site folder you'll need to adjust the
>>>> > settings in /etc/httpd/users/youruser.conf and that's explained more or
>>>> > less well at
>>>> > http://michaelkrol.com/2005/11/21/enable-mod_rewrite-on-os-x-104-tiger/
>>>> > but to be honest I've had a lot easier time always using the root
>>>> > (/Library/Webserver/Documents) directory for serving custom stuff.
>>>> >
>>>> > - David



More information about the FX.php_List mailing list