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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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