|
|
#1 (permalink) |
|
New Member
![]() Join Date: Mar 2007
Posts: 11
|
I have CGI stuff working, but I want to run a script as soon as the main site is visited (i.e. when this appears in the address bar: http://www.[whatever].com/ ). Currently, I simply redirect to http://www.[whatever].com/cgi-bin/script.cgi with JavaScript, but that's really annoying. I'm certain there's a better way to do it, but I don't know how.
Thanks in advance for any input. |
|
|
|
|
|
#2 (permalink) |
|
Super Noob
![]() |
it depends on whether your host allows you to run cgi scripts from anywhere within your site. if they do, you could simply have your script in the root directory like this... yourdomian.com/index.cgi
if not, redirecting your users is the only way, be it via a link, script or meta redirect makes no real difference. |
|
|
|
|
|
#4 (permalink) |
|
Silver Member
![]() |
My fav programmer has a couple of articles that offer ways to run a cgi script on page load -
http://www.bontragercgi.com/Running_...Page_Load.html http://www.bontragercgi.com/OnLoad_A...GI_Script.html
__________________
Best Regards --dlp dlperry.com Intuitive Website - Design + Enhancements + Software + Management + SEO |
|
|
|
|
|
#5 (permalink) |
|
New Member
![]() Join Date: Mar 2007
Posts: 11
|
Alright, in case anyone is running Apache, this is how you enable running CGI scripts anywhere you want to (this is for apache-2.0.54, so it might be somewhat different for the 2.2 releases):
1. find httpd.conf which might be in /etc/apache/something or something else under Windows. Searching for the file should be easy enough, how many files called httpd.conf could you possibly have? 2. open httpd.conf in a text editor. 3. find a line that says something like: Options Indexes FollowSymLinks This should be inside the <Directory "/path/to/webroot/htdocs"> section. This is important, since pretty much any <directory "/p/a/t/h/"> section could have such a line. Append ExecCGI to the line: Options Indexes FollowSymLinks ExecCGI NOTE: Windows probably won't have a FollowSymLinks option, since there are no symlinks in Windows. 4. Find a line that says something like: DirectoryIndex index.html This line should be outside all sections (i.e. not between <something> and </something>). It tells the webserver to automatically open index.html when you navigate to a directory. So, when you go to www.foo.com, it will open www.foo.com/index.html. Append index.cgi (or whatever you want as long as it ends in .cgi) to that line: DirectoryIndex index.html index.cgi Now, it will look for index.html and index.cgi. 5. Now, add a line (outside all sections) that says: AddHandler cgi-script .cgi Chances are that there is already such a line but it has been commented out. Try searching for it and removing the # from the beginning of the line. This line tells Apache that when it comes across a file that ends in .cgi, it should execute it rather than displaying its contents. Now, restart apache and make an index.cgi file in some directory and try to open it
__________________
- Misho |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|