문제

Can I use .htaccess to change the return value of $_SERVER['DOCUMENT_ROOT'] for local development only?

Currently, $_SERVER['DOCUMENT_ROOT'] returns,

C:\wamp\www

but I want it to return this,

C:\wamp\www\website_folder

Is it possible?

도움이 되었습니까?

해결책

Well, $_SERVER['DOCUMENT_ROOT'] returns the document route as defined in your server's config. I think you use http://localhost/website_folder (or host.com/website_folder) to access the site.

It doesn't return the website folder. You can create a new virtual host and set its document route to the appropriate folder, failin that, you cannot. Frankly, $_SERVER['DOCUMENT_ROOT']. IF you want the website path, you can always use

$serverPath=$_SERVER['DOCUMENT_ROOT']."/website_folder"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top