.:[May 25th - 11:04 CET/GMT-0500]:.

Tips & Tricks to RFC Compliant (x)HTML

Topics:

Document Types
Embed Flash objects in HTML
Switch pages to SSL (https://)
Embed audio in HTML
Prevent MSIE Browser using Mod Rewrite

SSL

To force your website into SSL (https://) put the following code in the top of your index.php file
Your webserver must be setup with PHP and SSL certificates for this to work.

Redirect all http:// requests to https://


	<?php if (!$_SERVER["HTTPS"]) { header("Location: https://www.yoursite.com/"); exit; } ?>
					

Usually you have to use fully-qualified hyperlinks because you have to change the URL scheme. But with the help of some URL manipulations through mod_rewrite you can achieve the same effect while you still can use relative URLs:
This rewrite ruleset lets you use hyperlinks of the form <a href="document.html:SSL">
Your webserver must be setup to use mod_rewrite and .htaccess files.

Use relative hyperlinks to switch between HTTP and HTTPS


	RewriteEngine on
	RewriteRule   ^/(.*):SSL$   https://%{SERVER_NAME}/$1 [R,L]
	RewriteRule   ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1  [R,L]
					

Top

Related pages