Sorry for asking this question again. Even though this has been asked and discussed quite a bit I cannot seem to find the right solution for a local dev environment using VirtualHost. I am using XAMPP Portable for Windows for dev work but assume this is the same for any other local server with regards to the .htaccess
file.
DocumentRoot of VirtualHost is D:\dev\www\
for example.
ServerName is devwork.webdev
for example.
HOSTS entry is 127.0.0.1 devwork.webdev
.
VirtualHost file does have a default DocumentRoot being DocumentRoot "D:/xampp/htdocs"
. It works just fine.
The projects are each in a folder under D:\dev\www\
for example D:\dev\www\project01\
or D:\dev\www\project02\
and so on and show nicely in the browser when going to devwork.webdev
with Options Indexes FollowSymLinks
enabled. Apache is not showing any error and the access log file is also OK, things are working.
Now in my HTML when I use <a href="/" class="navbar-brand">Project 01</a>
a click on the link does link me to D:\dev\www\
showing all the projects I have in that folder.
Instead I would like to be linked to the root of the project, being D:\dev\www\project01\
or rather http://devwork.webdev/project01/
.
How can I get that to work?
I am looking for a solution to this so that I can do dev work locally and without changing the HTML later FTP the data to the live host's root and it will work.
I have read and tried the following:
http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/
https://perishablepress.com/redirect-subdirectory-to-root-via-htaccess/ .htaccess How to redirect root URL to subdirectory files, rewrite to clean URL AND not affect subdomains?
http://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/
https://stackoverflow.com/a/990405/1010918
How to redirect /directory/index.html and /directory/index.php to /directory/
Redirecting /directory/index.html to /directory/
with
How to remove .html from URL
and
http://forums.modx.com/thread/77211/endless-friendly-url-redirect-from-subdomain-folder-location
being closest to what I think I need but I must be doing something wrong since I always arrive at the DocumentRoot instead of the folder where the project is kept under the DocumentRoot.
Thank you for any help.