Htaccess redirect / to cgi-bin/cgiscript.cgi not working

.htaccesscgiredirect

1st of all the disclaimer: this is my very first "meeting" with .htaccess, and I'm not a sysadm, never was, but the guy in the neighborhood, who used to set up the machine.

So now I have to set up one friends cgi (pyblosxom) based site (on freehostia).

I have a directory tree like this:

mysite (path on freehostia is: /home/www/sitename)
|-cgi-bin
||-cgiscript.cgi
|-pybloxsom-installation
|-data

My problem: I want to redirect all incoming request to http://mysubdomain.freehostia.com/ (the root, and if possible http://mysubdomain.freehostia.com/data/ and http://mysubdomain.freehostia.com/pybloxsom-installation/ ) to http://mysubdomain.freehostia.com/cgi-bin/cgiscript.cgi .

Could someone explain how to do that? All my tries lead to infinite redirections.

Best Answer

Try to put in a .htaccess file in the mysite directory :

RedirectMatch ^/$ http://mysubdomain.freehostia.com/cgi-bin/cgiscript.cgi
RedirectMatch ^/data/ http://mysubdomain.freehostia.com/cgi-bin/cgiscript.cgi
RedirectMatch ^/pybloxsom-installation/ http://mysubdomain.freehostia.com/cgi-bin/cgiscript.cgi

it might not work if your hosting provider doesn't allow it.

Related Topic