dimanche 26 août 2018

Changing root directory on multiple site setup using .htaccess

First of all, the following is an abstracted diagram of the folder structure.

www
├site01
│  └index.php
├site02
│  ├index.php
│  └style.css
└site03
   └index.php

Each subfolders are hosting its own websites. They are separate websites for separate services so they won't be refering or talking to each other. What I want to do is to set up .htaccess on each subfolders, to make each site to look at their respective subfolders as "/"(root) directory, instead of /www/, when resolving requests or directories. For example, if I was to link style.css from site02, I want the following line to work:

<link rel="stylesheet" href="/style.css">

I'd to this otherwise without using .htaccess if this was an on-premise or collocated server and I had full control. But since my client is using shared hosting, and I am tasked with migrating the sites that were previously being hosted on separate accounts into one account for "easier maintenance", it is not possible to set up multiple sites using apache setup, and would be extremely time-consuming to go through all the files and change the directories, hence this method.

I'd like to know if this is possible, and how it could be done. Thank you.




Aucun commentaire:

Enregistrer un commentaire