Server Side Frames

A Micro-Howto


You do not want to use frames because you want all your pages to be bookmarkable or simply because the client is somehow -ugh- unclean and you want to stay away from it as much as possible.


If you are using Apache this can be achieved using URL rewriting and SSI. If you are not, you are out of luck anyway. You need the following rewrite rules (in your .htaccess):

RewriteEngine	on
RewriteOptions	inherit

# Exclude
RewriteRule     ^.*_go\.pl$ 		-              [L]
RewriteRule     ^frame.*\.shtml$ 		-              [L]

# Rewrite everything to frame.shtml
RewriteRule     ^(.*)$	     			frame.shtml	

This translates all page requests to frame.shtml where the requested URL is included. Your frame.shtml should therefor contain

<!--#include virtual="$REQUEST_URI" -->


If you are using scripts you can not do POST requests to framed pages. Read about the POST 2 redirect pattern to find out why this is not necessarily a bad thing.