Martin
Martin

Reputation: 240

Change document root via .htaccess issue

When I echo out the document root I get this: /etc/httpd/htdocs

however I get the error, when I try to run my website:

No such file or directory in /vhost/vhost14/i/n/d/domainname.co.uk/www/testme.php

on this line of code

require_once($_SERVER['DOCUMENT_ROOT']."/_cmsscripts/_init.php");

if I replace the $_SERVER with /vhost/vhost14/i/n/d/domainname.co.uk/www/ it all works, but I've got loads of pages and don't really want to have to go around and change the whole site. First time I've had this issue and not sure how to get around it.

Upvotes: 0

Views: 63

Answers (1)

Axel Amthor
Axel Amthor

Reputation: 11096

Probably the document root is not where your current website in vhost is configured to or follow_symlinks is not enabled.

Anyway, in order to find things below the current file, you may use:

require_once(dirname($_SERVER['PHP_SELF'])."/_cmsscripts/_init.php");

Obviously, the document root can not be changed by .htaccess for security reasons

Upvotes: 1

Related Questions