Wednesday 15 October 2003 6:10:50 am
You are right, this is for a complete domain.
I don't know how to do this for just an directory, but maybe you could do something like this: (The following code is directly out of my head, i didn't tested it, so don't blame me if it doesn't work :-) ) [code]
<VirtualHost *:80>
ServerAdmin webmaster@domain.tld
DocumentRoot /path/to/www.domain.tld/
ServerName www.domain.tld
ErrorLog logs/error_log
CustomLog logs/access_log combined
RewriteEngine on
RewriteCond %{SERVER_POST} !^443$
RewriteRule ^/directory_that_needs_to_be_secure/(.*)$ https://www.domain.tld/directory_that_needs_to_be_secure/$1 [L,R]
RewriteCond %{SERVER_POST} !^443$
RewriteRule ^/another_directory_that_needs_to_be_secure/(.*)$ https://www.domain.tld/another_directory_that_needs_to_be_secure/$1 [L,R] </VirtualHost> [/code]
To do the opposite (from secure to non-secure) you must alter the virtual host from the secure site. There you must add the following lines: [code]
<VirtualHost *:443>
ServerAdmin webmaster@domain.tld
DocumentRoot /path/to/www.domain.tld/
ServerName www.domain.tld
ErrorLog logs/error_log
CustomLog logs/access_log combined
RewriteEngine on
RewriteCond %{SERVER_POST} !^80$
RewriteRule ^/directory_that_needs_not_to_be_secure/(.*)$ http://www.domain.tld/directory_that_needs_not_to_be_secure/$1 [L,R]
RewriteCond %{SERVER_POST} !^80$
RewriteRule ^/another_directory_that_needs_not_to_be_secure/(.*)$ http://www.domain.tld/another_directory_not_that_not_needs_to_be_secure/$1 [L,R] </VirtualHost> [/code] More detailed information can be found on http://httpd.apache.org/docs/misc/rewriteguide.html.
|