httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Galić <i.ga...@brainsware.org>
Subject Re: [users@httpd] Apache 2.2 URL Rewriting Guide From Static to Dynamic 404 Not Found script not found or unable to stat: redirect:/printenv.pl
Date Sun, 20 Feb 2011 20:37:57 GMT


----- Original Message -----
> Apache users:
> 
> I'm trying to learn how to use the Apache rewrite module to redirect
> incoming hits for virtual *.html pages to Perl CGI scripts using the
> information provided in the Apache 2.2 manual "URL Rewriting Guide"
> chapter "From Static to Dynamic" section:

Why? (http://bash.org/?866112)


>  
> http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html#static-to-dynamic
> 
> 
> For my first test, I am attempting to have hits for the page:
> 
>      http://bluefish.holgerdanske.com/printenv.html
> 
> invoke the script at URL:
> 
>      http://bluefish.holgerdanske.com/printenv.pl
> 
> which resides in file:
> 
>      /home/dpchrist/bluefish/public_html/printenv.pl
> 
> 
> When I invoke the script via its direct URL, everything works:
> 
>      http://bluefish.holgerdanske.com/printenv.pl
> 
> 
> But when I request the URL that is supposed to be rewritten:
> 
>      http://bluefish.holgerdanske.com/printenv.html
> 
> I see:
> 
>      404 Not Found
> 
> and the Apache error log says:
> 
>      script not found or unable to stat: redirect:/printenv.pl
> 
> 
> Also, I have attempted to enable the rewrite log and set the target
> directory mode to 0777, but no log file is written (?).

http://blag.esotericsystems.at/igor/says/no

You do not, NEVER EVER chmod something 0777. There is no place for
0777 on any server. Not even a test server. There is a place for
1777 and that place is /tmp and /var/tmp.
 
> Please see console session, below.
> 
> 
> Any suggestions?

Generally, mod_rewrite is debugged using RewriteLog.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritelog

But see below.
 
> TIA,
> 
> David
> 
> 
> 
> 2011-02-19 22:18:15 dpchrist@p43400e ~/bluefish
> $ cat /etc/debian_version
> 6.0


Aha.. might want to check out:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritelog
later on...
 
[snip]
> 2011-02-19 21:25:14 dpchrist@p43400e ~/bluefish
> $ l -w 64 /etc/apache2/mods-enabled/
> ./		       autoindex.conf@	mime.load@
> ../		       autoindex.load@	negotiation.conf@
> alias.conf@	       cgid.conf@	negotiation.load@
> alias.load@	       cgid.load@	reqtimeout.conf@
> auth_basic.load@       deflate.conf@	reqtimeout.load@
> authn_file.load@       deflate.load@	rewrite.load@
> authz_default.load@    dir.conf@	setenvif.conf@
> authz_groupfile.load@  dir.load@	setenvif.load@

How many people, I wonder, have mod_authz_groupfile loaded
without using it?

> authz_host.load@       env.load@	status.conf@
> authz_user.load@       mime.conf@	status.load@
> 
> 
> 
> 2011-02-19 21:54:51 dpchrist@p43400e ~/bluefish
> $ cat /etc/apache2/sites-enabled/bluefish.holgerdanske.com
> # $Id: bluefish.holgerdanske.com,v 1.5 2011-02-20 05:54:48 dpchrist
> Exp $
> <VirtualHost *:80>
>      ServerName   bluefish.holgerdanske.com
>      DocumentRoot           /home/dpchrist/bluefish/public_html
>      RewriteLog             /home/dpchrist/bluefish/log/rewrite.log
>      ScriptAlias  /cgi-bin/ /home/dpchrist/bluefish/cgi-bin/
> </VirtualHost>
[snip]
> 2011-02-19 21:57:14 dpchrist@p43400e ~/bluefish
> $ cat public_html/.htaccess
> # $Id: .htaccess,v 1.2 2011-02-20 05:47:55 dpchrist Exp $
> Options +ExecCGI
> AddHandler cgi-script pl
> RewriteEngine  on
> RewriteBase    /
> RewriteRule    ^printenv\.html$  printenv.pl  [H=cgi-script]


Why when you have full access to the config do you put your
rewrite rules in .htaccess?

Please their documentation for what they are good for:
http://httpd.apache.org/docs/current/howto/htaccess.html

Finally, I fail to see why you're even using rewrite for that thing?
You could just name your files .html, make them executable.

Options +ExecCGI would only pick up those that are exectuable.
Of course that's not "transparent" but if you're looking for
transparency, why not just *drop* .html *and* .pl from the *Request*
and have Options +MultiViews take care of serving the right file?

See my last mail to users@ which, too, suggests avoiding mod_rewrite:)
http://www.mail-archive.com/users@httpd.apache.org/msg46255.html

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message