How to delete my avatar?
Configuration of .htaccess file
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Apache HTTP Server > Configuration of .htaccess file 26 September 2005 22:04:53

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Configuration of .htaccess file

Frank Arensmeier 26 September 2005 22:04:53
 Hi.

I really hope that I am on the right list now...

I am new to Apache and I ran into a problem which I haven't found a
solution for yet. My server is Apache 1.3.33 on Mac OS X (the bundled
version). I am looking for a way to configure a .htaccess file the
following way:

1) in a certain path of my webserver, all 404 errors should be grabbed
and forwarded to a PHP script
2) I don't want Apache to send any headers before the PHP script
3) For your information only: The request is checked by the script and
the script will output a 404 header under some circumstances.

The most important part for me is the second one. For now my .htaccess
file only contains the following:

ErrorDocument 404 /link_to_PHP_script­.php

Obviously, this does not prevent Apache from sending a header with a
404 message. I saw in the Apache manual a module called ErrorHeader,
but I am not quite sure how to use this. When I extend the .htaccess
file with, e.g. ErrorHeader unset 404, my server gives my an internal
configuration error. And then, if I would unset a 404 header, would the
other part ("ErrorDocument 404 ...") still trigger the PHP script?

Google was not my friend this time, I would like to add.

Any help with this would be greatly appreciated.

Regards,
Frank


- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NIKE HYDRAULICS AB

Frank Arensmeier
Marknadssupport / Webmaster
tel 016 - 16 82 34
fax 016 - 13 93 16

frank.arensmeier@ni­kehydraulics.se
www.nikehydraulics.­se
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -


-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Joshua Slive 26 September 2005 16:09:47 permanent link ]
 On 9/26/05, Frank Arensmeier <frank.arensmeier@n­ikehydraulics.se> wrote:> Hi.>
I really hope that I am on the right list now...>
I am new to Apache and I ran into a problem which I haven't found a> solution for yet. My server is Apache 1.3.33 on Mac OS X (the bundled> version). I am looking for a way to configure a .htaccess file the> following way:>
1) in a certain path of my webserver, all 404 errors should be grabbed> and forwarded to a PHP script> 2) I don't want Apache to send any headers before the PHP script

I'm not sure if there is a way to do that with PHP. With a CGI
script, you simply give it a name starting in nph- (for "non-parsed
header") and then it gets to do all the headers itself (with a couple
exceptions).

But what you really want is simply to set the status of the response.
In that case, you can probably use something like
header('Status: 200 OK')
to set a non-error status.

Joshua.

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Eugene 26 September 2005 17:13:36 permanent link ]
 On Mon, Sep 26, 2005 at 08:09:47AM CDT, Joshua Slive <jslive@gmail.com> wrote:
: On 9/26/05, Frank Arensmeier <frank.arensmeier@n­ikehydraulics.se> wrote:
: >
: > I am new to Apache and I ran into a problem which I haven't found a
: > solution for yet. My server is Apache 1.3.33 on Mac OS X (the bundled
: > version). I am looking for a way to configure a .htaccess file the
: > following way:
: >
: > 1) in a certain path of my webserver, all 404 errors should be grabbed
: > and forwarded to a PHP script
: > 2) I don't want Apache to send any headers before the PHP script
:
: I'm not sure if there is a way to do that with PHP. With a CGI
: script, you simply give it a name starting in nph- (for "non-parsed
: header") and then it gets to do all the headers itself (with a couple
: exceptions).
:
: But what you really want is simply to set the status of the response.
: In that case, you can probably use something like
: header('Status: 200 OK')
: to set a non-error status.

I think there's a way to do either.

To redirect while sending the 404 status code to the client:

ErrorDocument 404 /path/to/script.php­

To redirect while NOT sending the 404 status code to the client:

ErrorDocument 404 http://www.yourserv­er.com/path/to/scrip­t.php


--
Eugene
eugene at fsck dot net

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Joshua Slive 26 September 2005 17:20:32 permanent link ]
 On 9/26/05, Eugene <list-apache@fsck.n­et> wrote:> I think there's a way to do either.>
To redirect while sending the 404 status code to the client:>
ErrorDocument 404 /path/to/script.php­>
To redirect while NOT sending the 404 status code to the client:>

I don't think that is what the OP is looking for. The second example
will, indeed, not send a 404. But it will send a 302 and cause the
browser to re-request at the new location.

Joshua.

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Frank Arensmeier 26 September 2005 17:38:29 permanent link ]
 Thank you all for your suggestions. It turned out that the answer is
quite simple. In the PHP script, the only thing to do is to send a
"HTTP 1/1 200 OK" status code. Because this will actually override the
previous 404. This was the simple answer to a question which I thought
seemed to be very complicated.

/frank
2005-09-26 kl. 16.20 skrev Joshua Slive:
On 9/26/05, Eugene <list-apache@fsck.n­et> wrote:>> I think there's a way to do either.>>
To redirect while sending the 404 status code to the client:>>
ErrorDocument 404 /path/to/script.php­>>
To redirect while NOT sending the 404 status code to the client:>>
I don't think that is what the OP is looking for. The second example> will, indeed, not send a 404. But it will send a 302 and cause the> browser to re-request at the new location.>
Joshua.>
-------------------­--------------------­--------------------­----------> The official User-To-User support forum of the Apache HTTP Server > Project.> See <URL:http://httpd.a­pache.org/userslist.­html> for more info.> To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org> " from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg> For additional commands, e-mail: users-help@httpd.ap­ache.org>


-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Sean Conner 26 September 2005 20:30:37 permanent link ]
 It was thus said that the Great Joshua Slive once stated:>
On 9/26/05, Frank Arensmeier <frank.arensmeier@n­ikehydraulics.se> wrote:> >
1) in a certain path of my webserver, all 404 errors should be grabbed> > and forwarded to a PHP script> > 2) I don't want Apache to send any headers before the PHP script>
I'm not sure if there is a way to do that with PHP. With a CGI> script, you simply give it a name starting in nph- (for "non-parsed> header") and then it gets to do all the headers itself (with a couple> exceptions).

What exceptions? I'm still having problems with Apache 2.0.54,
mod_rewrite and mod_cgi with a "nph-" CGI script (request gets rewritten by
mod_rewrite to my "nph-" CGI script, and Apache seems to output header
information in addition to the header I send---that doesn't happen if I go
directly to the script).

-spc (curious ... )




-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Joshua Slive 26 September 2005 22:04:53 permanent link ]
 On 9/26/05, Sean Conner <sean@conman.org> wrote:> > I'm not sure if there is a way to do that with PHP. With a CGI> > script, you simply give it a name starting in nph- (for "non-parsed> > header") and then it gets to do all the headers itself (with a couple> > exceptions).>
What exceptions? I'm still having problems with Apache 2.0.54,> mod_rewrite and mod_cgi with a "nph-" CGI script (request gets rewritten by> mod_rewrite to my "nph-" CGI script, and Apache seems to output header> information in addition to the header I send---that doesn't happen if I go> directly to the script).

Actually, I was thinking of mod_asis which always sets Date and
Server. I can't remember if nph- does that; probably not.

Nothing to do with your problem, which you should raise in a different
thread. (I'd start by adding [PT] to your RewriteRule flags.)

Joshua.

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Apache HTTP Server > Configuration of .htaccess file 26 September 2005 22:04:53

see also:
[JNDI/Naming/Network] - Re…
[EJB 3.0] - EntityManager is loosing…
[JBoss and NetBeans] - jBoss wsdl file…
пройди тесты:
Do you really know yourself?
see also:
Free Article Directory
everything for beuty
php script

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .