Forum Moderators: phranque

Message Too Old, No Replies

.htaccess - ssl

         

quali74

12:12 pm on Nov 15, 2010 (gmt 0)

10+ Year Member



Hello all

I have a public website with an admin system which can be accessed as follows:
[mysite.com...]
[mysite.com...]

I have a .htaccess for the public site

RewriteEngine on
Options +FollowSymlinks

DirectoryIndex index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?mode=$1 [L,QSA]


and no .htaccess for the admin site.


Now, I need to setup HTTPS access to the whole of the admin site
And HTTPS access for only some pages of public site


I do have a custom made certificate on my development server which reads as follow:
<VirtualHost *:443>
ServerAdmin me@test.com
DocumentRoot "/inetpub/wwwroot/mysite"
ServerName www.mysite.com
serveralias *.mysite.com

SSLEngine On
SSLCertificateFile conf/ssl/www.dev-server.co.uk.cert
SSLCertificateKeyFile conf/ssl/www.dev-server.co.uk.key

ErrorLog logs/www.mysite.com-error_log
CustomLog logs/www.mysite.com-access_log common
</VirtualHost>


Problems:
1 - At the minute, when I go to [mysite.com...] the browser detects the certificate, I click 'accept' but then is redirected to a 404 page...
2 - How do I force the .htacess to run only some of the public page using HTTPS


Any help would be very nuch appreciated
Thanks..

sublime1

3:17 pm on Nov 15, 2010 (gmt 0)

10+ Year Member



Use the HTTPS variable in a RewriteCond to test if HTTPS is on or off for the given request. See more about this in [httpd.apache.org...]

Tom

jdMorgan

11:12 pm on Nov 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In some cases,
RewriteCond %{HTTPS} =on

won't work, and you may find it easier and/or more-portable to use the logically-equivalent
RewriteCond %{SERVER_PORT} =443


Jim

quali74

3:43 pm on Nov 18, 2010 (gmt 0)

10+ Year Member



hi

Thanks for the reply but it's not working as I want...

I need my public site to work on port 80 and for some of the pages on port 443.

Now I get
Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.


when I go to the public site using http.

The admin site does the same when I use http.