LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[Webdev] Web security (https)

[Webdev] Web security (https)

adam lists at spamfilter.cc
Wed Apr 3 12:37:31 IST 2002


Hi Conor,

> I am using an Apache server which uses a digital certificate for security.
> How so you dynamically specify that a page should be https:// rather than
> http:// Do you specify it when opening the page using a link or can you
> list the files which require security somewhere?
>
If you want to /force/ HTTPS on some files or directories, you'll need to
configure it explicitly. You can do this with the Apache rewrite module, or
you can do it programatically in the files themselves. For example, with
mod_rewrite (locking files under /secure/ to HTTPS):

---
# Turn on the rewrite engine
RewriteEngine on
# IF the request is under /secure/
RewriteCond %{REQUEST_URI) ^/secure/
# AND IF the port is NOT 443 (HTTPS)
RewriteCond %{SERVER_PORT) !^443$
# Send the request to HTTPS
RewriteRule /(.*) https://www.server.com/$1
---

Or, with PHP:

---
<?php
// IF the port is not 443 (HTTPS)
if (getenv('SERVER_PORT') != 443) {
	// Send the request to HTTPS
	header('Location: https://' . getenv('SERVER_NAME') .
getenv('REQUEST_URI'));
}
?>
---

[These are really simple examples, they're not in context; they don't check
for errors; and they don't cater for, for example, a QUERY_STRING.]

adam





More information about the Webdev mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell