A
A
Alexey Daletskiy2016-01-04 12:59:48
htaccess
Alexey Daletskiy, 2016-01-04 12:59:48

How to configure htaccess to work with multiple sites?

There is hosting where it is impossible to change the physical address on the server for the main domain (/home/troykaby/public_html). And there are several laravel projects that need to be placed on this hosting. I was able to set up just one project by adding the following to .htaccess, which is located at the root of public_html:

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase /

# сайт troyka.by
RewriteCond %{HTTP_HOST} ^troyka.by$ [NC] 
RewriteCond %{REQUEST_URI} !^troykaby/public
RewriteRule ^(.*)$ troykaby/public/$1 [L]

# сайт www.troyka.by
RewriteCond %{HTTP_HOST} ^www.troyka.by$ [NC] 
RewriteCond %{REQUEST_URI} !^troykaby/public
RewriteRule ^(.*)$ troykaby/public/$1 [L]


When adding a similar block for another domain to the same .htaccess, it does nothing. Or rather, he swears at the domain being screwed, they say, access is denied.

PS Hoster support said that the address on the server for the main domain cannot be changed, although this would solve many problems.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Bloby, 2016-01-04
@Bloby

create subdomains for projects and that's it.

E
Eugene, 2016-01-04
@Nc_Soft

VDS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question