Apache Virtual Hosts - Map different paths of the same domain to different sites

I a running Apache/2.4.41 (Ubuntu)

I want to use only one domain name.

I would like to map different sites to different paths after the domain name.

For example:

maps to /var/www/test001/public

maps to /var/www/test002/public

I've already tried many different virtual host configurations but none of them worked.

so now I am trying to map to /srv/public , as below:

Alias /test002 /srv/test002/public_html

<Directory /srv/test002 /public_html> Order Allow,Deny Allow from all Options FollowSymLinks
</Directory>

the first site woks but the second site index page only works and if I tried to redirect to another page it will give '404 page not found'

the .htaccess of the second site is :

RewriteEngine On
RewriteBase /test002/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !.(js|css|eot|svg|ttf|woff|woff2|map)$ index.php [L]
RewriteCond $1 !^(index\.php|assets)

It is very weird, I have been working on it all day and no solution yet and couldn't find anything helpful on the web.

can anyone help me please?

6

1 Answer

I solve the problem by adding to the options in the directory :

Options +Indexes +followSymLinks

so it looks like this:

<Directory /srv/test002/public_html>

Order Allow,Deny

Allow from all

Options +Indexes +followSymLinks

</Director

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like