Hi guys & dolls,

I'm working on a website locally with MAMP and the directory tree is the same then that of the dev directory on my web server.
projects --> ecwc --> concept

But I've set the 'projects' directory on my webserver as a subdomain and this screws up my links.
Locally I have to create links like this: /projects/ecwc/concept/about/organisation.php
and for on my webserver they have to be like this: /ecwc/concept/about/organisation.php

Is it possible to set the 'concept' directory as a root directory with htaccess (htaccess file is in 'concept' directory) so that I can just create links like: /about/organisation.php? Like this will also be eventually the links for on the live server (in public_html), so I don't have to change anything.

Re: Changing root directory with htaccess 80 80

So you want to change the DocumentRoot? In that case it can be done only in these contexts:

  • server config
  • virtual host

It cannot be done at .htaccess level. More information here:

Re: Changing root directory with htaccess 80 80

Thanks Cereal, but I was totally wrong witn my previous thinking. I just need to look for the solution in PHP and have now something like this with my paths:

<a href="<?php echo $_SERVER['REQUEST_URI'].'about/organisation.php'; ?>">Organisation</a>

But this doesn't work with files from within a sub directory.

Re: Changing root directory with htaccess 80 80

I will close this thread by marking it as solved, because the real issue has nothing to do with .htaccess. Would be handy to have an option to close a thread instead tho.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.