From Static to Dynamic

Ask your mod_rewrite and Redirection questions here, and get answers!

From Static to Dynamic

Postby produke » 30 Oct 2006 20:45

Description:

How can we transform a static page foo.html into a dynamic variant foo.cgi in a seamless way, i.e. without notice by the browser/user.

Solution:

We just rewrite the URL to the CGI-script and force the correct MIME-type so it gets really run as a CGI-script. This way a request to /~quux/foo.html internally leads to the invocation of /~quux/foo.cgi.

Code: Select all
RewriteEngine  on
RewriteBase    /~quux/
RewriteRule    ^foo\.html$  foo.cgi  [T=application/x-httpd-cgi]



http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to Redirect or Rewrite Questions



Who is online

Users browsing this forum: ShakhtarrDon