Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default CGI handler in the webroot to handle all requests

Status
Not open for further replies.

cyberxy

Programmer
Apr 22, 2005
2
US
I need to handle this url:

What i need to do is have a script named something like index.cgi sitting in the webroot. I need this script to execute on any request to the server and i need the rest of the url to be passed as a PATH_INFO environment variable.

In other words, when the requested url is 'I want the PATH_INFO variable passed to the scrip to contan this: '/param1/param2/param3'. There is no directory named param1.

I would appreciate a suggestion on Apache configuration to be able to do this.

Thanks,
Boris
 
You mean that right now you have /param2/param3 in your webroot dir and you want to have web pages with a link like this:
<a href="/param1/param2/param3">My link</a> ?

If this is what you want then the only thing that you should do in your httpd.conf is:

Alias /param1/param2/param3 "/usr/local/apache/param2/param3"

You dont need to care how the PATH_INFO should look like, because everyone who browse your site will see (either on the links or on the address bar)
If that's not what you want then explain us a little better, what is it that you want.


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Thanks for a quick response.

Let me rephrase the question...
Basically, i am building a middle-ware server that redirects the users to proper destination, otherwise, the links that users currently have would be broken links.

Lots of users have hard-coded links such as this:
'param1, param2 and param3 could be any value, those values are not foreseeable, i just gave param1, param2, param3 as examples.
I need to intercept all requests that come to the server ' no matter what the rest of the URL contains.
Basically, it would be nice if a single script such as default.cgi would handle ALL requests coming to ' and the rest of the URL ('/param1/param2/param3' in this case) would be available to the script as a parameter. The script would parse this parameter and decide on the proper place to redirect the user.

Thanks for your help,
Boris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top