[NBLUG/talk] Weird Apache Question

Walter Hansen gandalf at sonic.net
Fri Aug 6 10:46:54 PDT 2004


Much thanks. This got me in the right dircetion I think. I am concerned
about the returning error code, but I think if I leave off the R it
doesn't give an error code. Do you know for sure? Leaving off the R leaves
the requested page in the browser window, so I'm thinking it makes it an
internal re-write without notifing the requesting browser.

I've checked and php can then read the requested page to deliver. In this
manner I can process the page name much like a get string.

Here's what I have up at the moment. I added a rule for index.html as I
didn't want that affected by this. There might be a better or more
efficant way to do that though.

RewriteEngine on
RewriteLog /var/log/httpd/http_rewrite_log
RewriteLogLevel 1
RewriteRule /index\.html /index.html [L]
RewriteRule /.*\.html /default.html [L]

<Files *.html>
   ForceType application/x-httpd-php
</Files>

Also the books I read gave me the <Files *.html> bit, but suggested that
there was a better way to do that. As I was on a timeline I just put up
the sloution that worked and left it there. If you know of a better/more
efficant way to do that I'd appreciate a hint. It turns on php processing
for all files of extention .html.

> I believe that would be mod_rewrite
>
> I think this stanza below would work inside of a virtual host container.
> Check my syntax twice... ; )  Log it if you want, if you don't comment
> them
> or don't include them.
>
> RewriteEngine on
> RewriteLog /var/log/httpd/http_rewrite_log
> RewriteLogLevel 1
> RewriteRule ^/(.*) http://mysite.com/file.html [L,R]
>
> On Friday 06 August 2004 09:16, Walter Hansen wrote:
>> I've done a little goggling on this with no luck. I'll be doing some
>> more
>> reasearch on it later, but I think it's not exatly a common question so
>> I
>> wondered if any of you might have had this come up and know where to
>> look.
>>
>> I'd like to have an Apache 2.X server have a default web page. Not
>> default
>> as in index.html but so that any request www.server.com/file.html will
>> go
>> to that page instead of generating a 404 error. Yes I know I could
>> customize the 404 error, but I want to instead have it serve
>> default.html
>> without a complaint. Also this would be for only one vitural server out
>> of
>> many.
>>
>> Anybody ever see anything like this or know where I should look?
> --
> Mark Street, RHCE
> http://www.oswizards.com
> --
> Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0
> GPG key http://www.oswizards.com/pubkey.asc
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>






More information about the talk mailing list