Place a file in the public_html/ directory called .htaccess, containing one line:
DirectoryIndex cgi-bin/c.cgi?menu=1
| [reply] [d/l] [select] |
As noted the optimal way is using httpd.conf either directly or via a .htaccess file. You can rediret by placing this as you index.html. It will not hide the URL for you, but will get you to your cgi just by going to localhost/~user/
<head>
<title>Please wait while we redirect you.....</title>
<meta http-equiv="refresh" content="0; url=http://localhost/~user/cgi-
+bin/c.cgi?menu=1">
<script>window.location.href="http://localhost/~user/cgi-bin/c.cgi?men
+u=1"</script>
</head>
| [reply] [d/l] |
You could override it in the httpd conf file. | [reply] |
| [reply] |
Many hosts allow you to but .cgi files in any directory as long as they have the .cgi extention. Those hosts usually have index.cgi in the list of files for which to look if a directory name is provided as the URL.
In other words, if you place c.cgi in the directory you named, rename c.cgi to index.cgi, and make sure you there are no index.html, index.htm, etc, in the same directory, it might work without messing with the server's config files or with .htaccess.
The url would then be
http://localhost/~user/?menu=1
or
http://localhost/~user/book/?menu=1
unless 1 is the default value for menu.
| [reply] [d/l] [select] |
I've encountered the same problem, and this is how I managed to solve it...
Basically, create a new file called "index.shtml". Leave c.cgi within the cgi-bin directory. Then, inside the index.shtml file, put:
< !--#include virtual="/cgi-bin/c.cgi" -- >
The stuff in the quotations, as could probably be guessed, is the path to your CGI script. However, this method will make it show up when you go to the directory with index.shtml inside of it. (There must be no other "index" files in the directory, I'm pretty sure) The CGI will appear to be the home/main page. However, once a link is taken to itself, like "c.cgi?menu=1", it will show up as "cgi-bin/c.cgi?menu=1".
Hope I was helpful, Spidy
P.S.-I'm fairly certain that inside the URL in the include, you can have something like "c.cgi?menu=1". You're also going to have to get rid of the spaces between < and !, and - and >. | [reply] |
if using Apache, you can use mod_rewrite, in a .htaccess file, write something like:
RewriteEngine on
RewriteBase /~user/
RewriteRule ^book /~user/cgi-bin/c.cgi?menu=1
you can learn more about mod_rewrite at apache's documentation, or by Googling.
| [reply] [d/l] [select] |
The easiest way (but not nearly as elegant) is to use frames. and have the code target the main frame, then only the frame url will be displayed.
You could also use redirect in .htaccess. Here is a decent tutorial on .htaccess | [reply] |