简体   繁体   中英

Apache rewrite for .png files

I am working with a system accessed by multiple tenants.

Ideally I need to display different logo .png files for different customers.

To remain using a single site, I would like to use Virtualhosts and ServerName functions to identify which client connects and then rewrite the default logo file to a more specific file.

ie when connecting using customer1.example.com you get customerlogo1.png, but when connecting to customer2.example.com you get customerlogo2.png. I tried the below but it doesn't work.

Can anyone help? It would be much appreciated.

<VirtualHost *:80>
ServerName customer1.example.com
DocumentRoot /usr/share/customers/www
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^customerlogo1.png$ customerlogo2.png
</VirtualHost>

<VirtualHost *:80>
ServerName customer2.example.com
DocumentRoot /usr/share/customers/www
</VirtualHost>

This if I understand you?

<VirtualHost *:80>
ServerName customer1.example.com
DocumentRoot /usr/share/customers/www
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^customerlogo\.png$ customerlogo1.png [L]
</VirtualHost>

<VirtualHost *:80>
ServerName customer2.example.com
DocumentRoot /usr/share/customers/www
RewriteEngine On
RewriteRule ^customerlogo\.png$ customerlogo2.png [L]
</VirtualHost>

In your HTML document, you use the same generic customerlogo.png.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM