Click to See Complete Forum and Search --> : force clients to use HTTPS
Infested Flar
03-22-2001, 10:46 AM
here. i have domain. and users read their mails through a webmail. say http://www.mydomain.org/webmail. i just want the webmail to be secured.
1. i want to force them to use https not http. say if a user typed http://www.mydomain.org/webmail it will go for an error or not able to see the page.
2. he/she should issue https://www.mydomain.org/webmail on his/her browser in order to see the page.
can someone show me a link? or a good URL bout it? or tell me how to do it? ive been through modssl's (http://www.modssl.org) website but found nothing in there. i think its outdated. btw, am using apache1.3.14/modssl .. can anyone point this one to me out?
thanks much in advance!
-flar-
[ 22 March 2001: Message edited by: flar ]
freebsd
03-22-2001, 11:34 AM
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/webmail [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://www.yourdomain.org/$1 [L,R]
This will not redirect to an error. Instead, redirects to the URL with https. Place this inside the <Directory> block or <VirtualHost>.
A direct request (with no http referer) of http://www.yourdomain.org/webmail/login.php will be redirected to https://www.yourdomain.org/webmail/login.php
A direct request of http://www.yourdomain.org/webmail will be redirected to https://www.yourdomain.org/webmail/
Infested Flar
03-22-2001, 11:45 AM
its not working. :( it gave me an error.
# /usr/local/apachessl/bin/apachectl startssl
Syntax error on line 960 of /usr/local/apachessl/conf/httpd.conf:
Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration
/usr/local/apachessl/bin/apachectl startssl: httpd could not be started
i dont have that TAG ?? or have i missed something.
-flar-
freebsd
03-22-2001, 12:07 PM
>> or have i missed something
Yes, no mod_rewrite compiled in. If mod_rewrite is available as a share module (DSO), enable it. If not, recompile Apache and enable mod_rewrite (not a default module).
Infested Flar
03-22-2001, 12:10 PM
ive got it to work somehow but not with the LINES u gave above. and i just dunno why those lines wont work. thats mod_rewrite eh? havent play with those before. anyway, someone gave me a php script on how to redirect it. but i just want the configs to be on httpd.conf .. hmm.. :rolleyes:
-flar-
Infested Flar
03-22-2001, 12:12 PM
oh ok.. ill try that one.. hmm.. recompile again :p
-flar-
freebsd
03-22-2001, 12:23 PM
Whatever official directive that is listed in http://httpd.apache.org/docs/mod/directives.html that is causing perhaps mis-spelled or defined by.., in most case you don't have that module compiled in.
>> someone gave me a php script on how to redirect it
Don't use it. Remember I told you to put those lines within <Directory> or <VirtualHost> although .htaccess is allowed?
That's mainly a concern of performance and resource. If you have access to httpd.conf, do it there. Using php requires more process and resource so it's not the right approach since you can do the same thing wisely in httpd.conf.
Infested Flar
03-22-2001, 12:30 PM
ok thanks much!! ill be back here to whatever is the output .. wish me luck :)
-flar-
Infested Flar
03-22-2001, 02:17 PM
hey freebsd!! guess what!! :) ive got it workin.. :D :D :D thanks for the help!! ill just save the script that ive got :) thanks again
-flar- :cool:
Fandelem
03-26-2001, 06:54 PM
can i see the script? ;o)
(email: fandelem@hotmail.com)
Infested Flar
03-27-2001, 06:43 AM
done :D
-flar-