logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Forcing all Non-CGI Files to be wrapped
Author
iamwyza



Joined: 16 May 2007
Posts: 15

PostPosted: Tue 17 Jul '07 13:48    Post subject: Forcing all Non-CGI Files to be wrapped Reply with quote

I don't know if this is possible but here is what I would like to do.

Tell the server that if the file it is handling is not a CGI file then it needs to pass the dir/name of the file to this CGI wrapper which will handle it from there, however i want the url to still show the page as though you were looking at the file directly, not through the wrapper.

ex:

http://yoursite.com/help/ohno.html

apache sees its not a cgi and says

http://yoursite.com/wrapper.cgi?help/ohno.html

but the user sees

http://yoursite.com/help/ohno.html


TiA
Back to top
iamwyza



Joined: 16 May 2007
Posts: 15

PostPosted: Tue 17 Jul '07 13:50    Post subject: Reply with quote

oh, and we are running apache 2.0.x
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Tue 17 Jul '07 13:59    Post subject: Reply with quote

You could use mod_rewrite or adding the handler to html files.

AddHandler cgi-script .html
Back to top
iamwyza



Joined: 16 May 2007
Posts: 15

PostPosted: Tue 17 Jul '07 14:20    Post subject: Reply with quote

If i understand the limited documentation AddHandler function it simply tells it to use the cgi engine to handle the file which is sadly not enough. I need it to be calling my authentication bit before it serves the page to make sure the user is supposed to be getting the page.

I considered mod_rewrite, but i am not a rewrite guru. I reading through a rewriting guide i see where you could tell .html as .cgi but that still doesn't solve my problem. It basically leads itself to needing to modify all the .html to have CGI in them which i don't want.[/code]
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Tue 17 Jul '07 15:09    Post subject: Reply with quote

As I said, use mod_rewrite
There are a lot of examples on that page.

like
Code:

RewriteRule ^/help/([^/]*) /wrapper.cgi?help/=$1 [PT]
Back to top
iamwyza



Joined: 16 May 2007
Posts: 15

PostPosted: Tue 17 Jul '07 16:46    Post subject: Reply with quote

which does this

http://yoursite.com/help/ohno.html

becomes

http://yoursite.com/wrapper.cgi?help/ohno.html

but the user sees this change, i want to make it transparent so that from their point of view the uri is still:

http://yoursite.com/help/ohno.html
Back to top


Reply to topic   Topic: Forcing all Non-CGI Files to be wrapped View previous topic :: View next topic
Post new topic   Forum Index -> Apache