Friday, January 28, 2011

Pointing a subdomain at a file

Switched hosting recently (Linux, CPanel, WHM). At the old host, there was a subdomain that had a file (instead of a directory) as a root. The file was a CGI script. The said subdomain was created via CPanel by me a while ago.

At the new host, I'm trying to recreate this subdomain. And I get the following error:

The directory, /home/(...)/cgi-bin/guest.cgi could not be created.

Is there a tweak somewhere that enables this functionality?

EDIT: tried to repeat the trick on the old site, and I could not. CPanel update broke it, maybe?

  • Perhaps you had an .htaccess on the subdomain created that leads the user to guest.cgi with a internal redirect ?

    AFAIK cpanel subdomain will create the subdomain folder, so for example:

    Our domain will be domain.com and our subdomain will be test

    cPanel will create the subdomain for you and a default structure folder at the root of domain.com: /home/domain.com/test

    Now you make a simple .htaccess file inside test with the follow content:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/guest.cgi$
    RewriteRule . cgi-bin/guest.cgi [L]
    

    The above file will redirect any request made to test.domain.com to be redirected to cgi-bin/guest.cgi !

    Perhaps you had something like this on your subdomain... you can use a simple redirect in php aswell if you wish, make a index.php on the test.domain.com with the content:

    <?
    Header( "Location: http://test.domain.com/cgi-bin/guest.cgi" );
    ?>
    
    Seva Alekseyev : I just checked .htaccess in the cgi-bin folder - it was not like this. But then again, it could've been implemented via upper-level Apache configs. I don't have root rights on that box.
    Prix : @Seva it is not inside cgi-bin that the .htaccess should be but inside the root folder.
    pjz : @Prix it could be anywhere up the tree to the root or in the /etc configs.
    Prix : @pjz cgi-bin folders usually have httpd.conf rules which may get overwritten so it would not work and ALSO he wants the root test.domain.com to get to test.domain.com/cgi-bin/guest.cgi so if that .htaccess is inside the cgi-bin forlder it would never work.
    From Prix

0 comments:

Post a Comment