Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Rules Problem on Apache 2.0

file not found when i tell it where it is.....

         

incrediBILL

12:00 am on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



We use rewrite rules to mask out the /cgi-bin/somescript.cgi/ from the path of our web site and in Apache 1.x and it blindly ran the path specified with the script alias appended without checking if the file existed.

Now, in Apache 2.0 they actually check to see if the page name exists in either our public or private docs folder before running the page with the script alias appended. This causes a HUGE problem as we were running some dynamic pages where the page names didnt actually exist, the script was figuring out what content to deliver based on the page name. Now we have to put a bogus placeholder "filename.html" for each page that was previously dynamic in Apache 1.x and it's making a big mess.

I came up with one solution which was to override "ErrorDocument 404" and redirect it to my dynamic page generator, which worked well for browsers but the search engines still see the 404 and won't crawl the page.

Banging head on wall - any ideas?

Here's the script....

RewriteEngine On

RewriteCond /home/httpd/vhosts/domain.com/httpdocs/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /home/httpd/vhosts/domain.com/httpdocs/$1 [L]
RewriteCond /home/httpd/vhosts/domain.com/private/%{REQUEST_FILENAME} -f
RewriteRule ^(.+) /home/httpd/vhosts/domain.com/private/$1 [L]
RewriteRule ^(.+) - [PT]

ScriptAlias /cgi-bin/ "/home/httpd/vhosts/domain.com/cgi-bin/"
<Directory "/home/httpd/vhosts/domain.com/cgi-bin/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
<Directory "/home/httpd/vhosts/domain.com/httpdocs/">
DirectoryIndex home.html index.htm index.html default.htm Default.htm
Action cgi-webc /cgi-bin/somescript.cgi
AddHandler cgi-webc html
Options ExecCGI Includes MultiViews
AddHandler default-handler .gif
AddHandler default-handler .jpg
</Directory>
<Directory "/home/httpd/vhosts/domain.com/private/">
DirectoryIndex index.htm index.html default.htm Default.htm
Action cgi-webc /cgi-bin/somescript.cgi
AddHandler cgi-webc html
Options ExecCGI Includes MultiViews
AddHandler default-handler .gif
AddHandler default-handler .jpg
</Directory>

jdMorgan

12:23 am on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're not using MultiViews, try disabling them...

Jim