Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI Directory Redirect

         

ucs308

10:07 pm on Mar 13, 2003 (gmt 0)

10+ Year Member



I have searched these pages and found a number of ways to redirect a page request. Trouble is none of them do what I need or so it appears.

My ISP (XO Communications) forces all scripts to be in the CGI directory. So if I want to have a URL of www.domain.com/gallery.php, the user has to type www.domain.com/cgi/gallery.php. This must be a common scenario.

What I want is for www.domain.com/gallery.php to implictly mean www.domain.com/cgi/gallery.php.

I tried creating a .htaccess file with the following entry.

redirect 301 / //www.domain.com/cgi

or

redirect 301 /web //www.domain.com/cgi

or

redirect 301 /web/test_index.html [domain...]

none of which worked. In short I am trying to hide the CGI portion of the URL no matter what. So the user never sees it. Is this possible?

dive into perl

10:23 pm on Mar 13, 2003 (gmt 0)

10+ Year Member



Hi ucs308,

If your server is running Apache then the syntax is:-

Redirect old-URI new-URL

e.g. :-

Redirect gallery.php www.domain.com/cgi/gallery.php

This has worked for me in the past.

Thanks,

nosanity

8:00 am on Mar 14, 2003 (gmt 0)

10+ Year Member



You might want to search this forum for mod_rewrite. I think that is more what you are looking for... great module, and has saved my butt a few times.

noSanity

Allen

8:54 am on Mar 14, 2003 (gmt 0)

10+ Year Member



You should also check that your ISP allows htaccess files and that they allow you to do redirects in htaccess files.

Allen