A RECIPE FOR DYNAMIC WEBSITES WITH PERL
or how to turn all ".html" URLs in a directory into dynamic pages via CGI scripts.
1. Enable Overrides on a directory by directory basis.
You'll want something like the following in your file /etc/httpd/conf/httpd.conf
<Directory "/home/website/htdocs">
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
Options Indexes FollowSymLinks ExecCGI
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
It's the AllowOverride All that's vital here.
2. Ensure that your Apache server supports modi_rewrite
This line must be present (and not commented out) in /etc/http/conf/httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
If you have had to change your configuration file at steps 1 or 2, remember to restart Apache so that it re-reads the config file!
3. Turn the RewriteEngine on as appropriate
In a file called .htacceess in the directories you want to forward:
RewriteEngine On
RewriteRule ^(.*)\.html /cgi-bin/summat.cgi?what=$1
4. Provide the script to which you've targeted your pages
#!/usr/bin/perl
print "content-type: text/html\n\n";
print "I done REAL fab<br>";
($name,$value) = ($ENV{QUERY_STRING} =~ /(.*)=(.*)/);
print "You have called up page $value.html";
See also
Further httpd configuration
Please note that articles in this section of our
web site were current and correct to the best of our ability when published,
but by the nature of our business may go out of date quite quickly. The
quoting of a price, contract term or any other information in this area of
our website is NOT an offer to supply now on those terms - please check
back via
our main web site
Web Application Deployment - Apache httpd mod_rewrite [631] - ()
[755] - ()
[934] - ()
[1006] - ()
[1009] - ()
[1207] - ()
[1376] - ()
[1381] - ()
[1636] - ()
[1731] - ()
[1771] - ()
[1778] - ()
[1954] - ()
[2094] - ()
[2555] - ()
[2728] - ()
[2768] - ()
[2773] - ()
[2900] - ()
[2981] - ()
[3197] - ()
[3339] - ()
[3568] - ()
[3753] - ()
[3862] - ()
Perl on the Network [2047] - ()
Perl - More CGI Programs and Facilities [641] - ()
[1009] - ()
[1187] - ()
[2321] - ()
Web Application Deployment - Further httpd Configuration [345] - ()
[466] - ()
[526] - ()
[550] - ()
[631] - ()
[649] - ()
[662] - ()
[755] - ()
[853] - ()
[934] - ()
[1009] - ()
[1080] - ()
[1121] - ()
[1207] - ()
[1351] - ()
[1355] - ()
[1377] - ()
[1381] - ()
[1551] - ()
[1554] - ()
[1564] - ()
[1566] - ()
[1619] - ()
[1636] - ()
[1707] - ()
[1762] - ()
[1767] - ()
[1778] - ()
[1939] - ()
[1954] - ()
[1955] - ()
[1974] - ()
[2060] - ()
[2272] - ()
[2478] - ()
[2900] - ()
[3133] - ()
[3449] - ()
[3635] - ()
[3862] - ()
[3955] - ()
[4001] - ()
[4307] - ()
Web site techniques, utility and visibility [23] - ()
[32] - ()
[98] - ()
[109] - ()
[117] - ()
[142] - ()
[165] - ()
[173] - ()
[179] - ()
[182] - ()
[197] - ()
[202] - ()
[222] - ()
[259] - ()
[261] - ()
[268] - ()
[274] - ()
[276] - ()
[278] - ()
[284] - ()
[288] - ()
[311] - ()
[314] - ()
[320] - ()
[322] - ()
[347] - ()
[348] - ()
[369] - ()
[376] - ()
[414] - ()
[492] - ()
[510] - ()
[528] - ()
[533] - ()
[649] - ()
[658] - ()
[681] - ()
[718] - ()
[732] - ()
[757] - ()
[767] - ()
[800] - ()
[893] - ()
[916] - ()
[976] - ()
[994] - ()
[1015] - ()
[1029] - ()
[1055] - ()
[1104] - ()
[1177] - ()
[1184] - ()
[1186] - ()
[1198] - ()
[1207] - ()
[1212] - ()
[1237] - ()
[1297] - ()
[1437] - ()
[1494] - ()
[1505] - ()
[1506] - ()
[1513] - ()
[1534] - ()
[1541] - ()
[1554] - ()
[1610] - ()
[1630] - ()
[1634] - ()
[1653] - ()
[1711] - ()
[1747] - ()
[1756] - ()
[1793] - ()
[1797] - ()
[1833] - ()
[1856] - ()
[1888] - ()
[1955] - ()
[1961] - ()
[1970] - ()
[1982] - ()
[2056] - ()
[2065] - ()
[2225] - ()
[2332] - ()
[2333] - ()
[2334] - ()
[2335] - ()
[2336] - ()
[2337] - ()
[2338] - ()
[2339] - ()
[2340] - ()
[2340] - ()
[2341] - ()
[2389] - ()
[2410] - ()
[2519] - ()
[2532] - ()
[2552] - ()
[2569] - ()
[2668] - ()
[2981] - ()
[3022] - ()
[3087] - ()
[3149] - ()
[3197] - ()
[3367] - ()
[3426] - ()
[3491] - ()
[3532] - ()
[3554] - ()
[3563] - ()
[3589] - ()
[3623] - ()
[3734] - ()
[3744] - ()
[3745] - ()
[3776] - ()
[3896] - ()
[3974] - ()
[4001] - ()
[4076] - ()
[4115] - ()
[4136] - ()
[4239] - ()
[4376] - ()
[4401] - ()
[4474] - ()
[4492] - ()
resource index - Perl
Solutions centre home page
You'll find shorter technical items at
The Horse's Mouth and
delegate's questions answered at
the
Opentalk forum.
At Well House Consultants, we provide
training courses on
subjects such as Ruby, Lua, Perl, Python, Linux, C, C++,
Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer)
many questions, and answers to those which are of general
interest are published in this area of our site.