Forum Moderators: phranque

Message Too Old, No Replies

problems with apache cgi setup

         

gnarfle

7:02 pm on Jun 7, 2010 (gmt 0)

10+ Year Member



Hi all,

I have an odd situation with a client at a large university. To use php I have to set it up as a cgi and all I have is a .htaccess file to work with.

I can set everything up with:


RemoveHandler .php
AddType application/my-httpd-php .php
Action application/my-httpd-php /php.cgi


Per the instructions from the university.

The problem is, the site can be accessed (and is) from both subdomain.university.edu and university.edu/~subdomain

With the above php works fine at subdomain.university.edu. However it does not work in university.edu/~subdomain as the path to php is wrong. Of course I can configure it to point to /~subdomain/php.cgi and then have the opposite problem.

Since all I have is a .htaccess file, a ScriptAlias is out. Does anyone know of a way I can configure this to work on both URL's?

jdMorgan

3:42 pm on Jun 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should not "configure it to work on both URLs," as that creates a duplicate content problem.

Instead, 301-redirect the mod_userdir-format URLs to the subdomain-format URLs.

mod_userdir is an ancient 'kludge' from before name-based servers were possible (HTTP/1.0) and you are replacing it here with the subdomain-to-filespace mapping function of mod_rewrite. Since you cannot just disable mod_userdir, a 301 redirect is the best second choice.

Jim