I am running a website on MAMP, and the root is http://localhost/sandbox
When I have links that link to, for example – /calendar
it directs them to localhost/calendar, I want it to redirect to localhost/sandbox/calendar
What would I have to do in htaccess to get it to redirect everything to localhost/sandbox/ as the root?
You would usually change the application or site that generates the links, and have that add the
/sandboxto the URL.If that’s not possible, putting this into the web root directory (the one above
/sandbox) should do:(if it’s easier to achieve with
Alias, Apache Gurus, feel free to add your solution, but I couldn’t get Alias to work for this scenario.)However, this solution will make any other directory besides
/sandboxinaccessible. You may want to re-think your Virtual hosts structure!