.htaccess subdomains and shared files

I have a file structure that serves mutliple top-level domains .htaccess pushes requests to domain-specific directories:

...

ReWriteCond %{REQUEST_URI} !webroot/domains/www.sitea.com/

ReWriteRule ^(.*)$ webroot/domains/www.sitea.com/$1 [L]

ReWriteCond %{REQUEST_URI} !webroot/domains/www.siteb.com/

ReWriteRule ^(.*)$ webroot/domains/www.siteb.com/$1 [L]

...

.htaccess at the domain level (for example, webroot / domains / www.siteb.com / .htaccess) then applies various rules for managing URLs for domain pages:

...

DirectoryIndex pageincludes/home.php

RewriteRule ^home$ pageincludes/home.php [L]

...

So, the file structure looks something like this:

/webroot/domains/www.sitea.com/

/webroot/domains/www.siteb.com/

/webroot/js/script1.js

/webroot/images/image1.png

My problem is that I want to be able to use shared resources on served pages, for example:

<script type="text/javascript" src="/js/script1.js"></script> <img src="/images/image1.png" alt="80%"></img>

These resources were not found by the client. Is this template not a starter or is there a way I can get this to work?

Many thanks.

+3
source share
3 answers

. , Apache . .

:

ln/webroot/js/webroot/domains/www.sitea.com/js

+1

, , js images.

, , , , , ( ). ( apache ), .

0

, . .

ReWriteCond %{REQUEST_URI} !^(js|images)

?

0
source

Source: https://habr.com/ru/post/1732534/


All Articles