Reputation: 5941
Is there a way to make .htaccess tell a folder to act as the lowest level? What I mean is this, say you have a folder like so:
/about/ /contact/ /css/ /images/ .htaccess index.php header.php
If they are at /contact/index.php
, then if I have <a href="../index.php">Home</a>
to go to the home page, it works all fine, but if they are on the actual main page, it will try to go a directory lower.
The reason is because Im trying to test sites in sub-folders.
Upvotes: 3
Views: 2525
Reputation: 12078
On /contact/index.php you can link to main index.php by using
<a href="/index.php">Link</a>
Upvotes: 0
Reputation: 11574
This is a bit hacky... but you could create the /home folder and put a duplicate copy of your index.php in there. Again, it is a total hack, but it should resolve what you are trying to do.
Another thing to consider is using mod_rewrite in the .htaccess to look for /home and route to the root directory.
Upvotes: 1
Reputation: 97835
The directly answer your question, the answer is no. By the time, .htaccess is read, the path was already translated to a directory.
If you want to change the root, you have to do it in httpd.conf
(or rewrite all the requests in the root to the destination directory). If you want to have several roots (under different domains), you have to use virtual hosts (again, only in httpd.conf
).
You can also make your site work when it's not in the root directory.
Upvotes: 4