[support] http/s issues (still)

sander-martijn lists at severeddreams.com
Sat Oct 6 19:07:43 UTC 2007


Oops - I meant to point out that it's the following lines in the non-ssl 
redirect that made the difference:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

sander-martijn wrote:
> After days of messing with this I finally figured it out.  It seems I 
> needed to have the following lines in the rewrite in order for it to 
> work properly with the drupal rewrite already in place:
> 
> 
> It now works so I wanted to post this for anyone else trying to get ssl 
> working on only certain sections of their sites.  Including the drupal 
> rewrites already in .htaccess, my rewrites now look like this:
> 
>    # REWRITE TO NONSSL UNLESS IT'S THE FORM, FORM EDIT/RESULTS PAGES
>    # OR SUPPORTING FILES
>    RewriteCond %{SERVER_PORT} ^443$
>    RewriteCond %{REQUEST_URI} !(contact/requestBook)
>    RewriteCond %{REQUEST_URI} !(node/387/*)
>    RewriteCond %{REQUEST_URI} !(.*css)
>    RewriteCond %{REQUEST_URI} !(.*js)
>    RewriteCond %{REQUEST_URI} !(.*gif)
>    RewriteCond %{REQUEST_URI} !(.*png)
>    RewriteCond %{REQUEST_URI} !(.*jpg)
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteCond %{REQUEST_FILENAME} !-d
>    RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [R=301,L]
> 
>    # REWRITE TO SSL IF IT'S THIS FORM
>    RewriteCond %{SERVER_PORT} !^443$
>    RewriteCond %{REQUEST_URI} contact/requestBook
>    RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
> 
>    # DRUPAL REWRITE
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteCond %{REQUEST_FILENAME} !-d
>    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
> 
> .s
> 
> sander-martijn wrote:
>> Hi guys,
>>
>> I'm still having an http to https and back issue with drupal, but I've 
>> narrowed it down to a single L and wondering if anyone has any 
>> suggestions now.  The L stands for "Last Rule" - if it's there it 
>> behaves half correctly and if it's not there it behaves half correctly - 
>> in the opposite way.
>>
>>   # REWRITE TO SSL if contact/requestBook
>>   # WORKS AS EXPECTED ON IT'S OWN
>>   RewriteCond %{SERVER_PORT} !^443$
>>   RewriteRule ^(contact/requestBook)$ https://%{SERVER_NAME}/$1 [R=301,L]
>>  
>>   # REWRITE TO NON-SSL if not contact/requestBook
>>   # also ignore if a supporting file or else the page will display a 
>> broken lock
>>   # IF [R=301,L] then any other page on https redirects to non-ssl fine 
>> but contact/requestBook redirects to non-ssl non-pretty url
>>   # http://s24863.gridserver.com/index.php?q=contact/requestBook
>>   # IF you remove the L so it's [R=301] then contact/requestBook 
>> redirects fine but other pages stay on https and report Page not found
>>   RewriteCond %{SERVER_PORT} ^443$
>>   RewriteCond %{REQUEST_URI} !(contact/requestBook)
>>   RewriteCond %{REQUEST_URI} !(.*css)
>>   RewriteCond %{REQUEST_URI} !(.*js)
>>   RewriteCond %{REQUEST_URI} !(.*jpg)
>>   RewriteCond %{REQUEST_URI} !(.*gif)
>>   RewriteCond %{REQUEST_URI} !(.*ico)
>>   RewriteCond %{REQUEST_URI} !(.*png)
>>   RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [R=301]
>>   # Alternate: RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [R=301,L]
>>  
>>   # DRUPAL REWRITE
>>   RewriteCond %{REQUEST_FILENAME} !-f
>>   RewriteCond %{REQUEST_FILENAME} !-d
>>   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
>>
>>
>> Thanks,
>> sander


More information about the support mailing list