lscache_wp icon indicating copy to clipboard operation
lscache_wp copied to clipboard

.htaccess file updated with incorrect host on multisite

Open DeanMarkTaylor opened this issue 4 years ago • 0 comments

Steps to reproduce

  1. Setup a domain based multisite on example.net
  2. Add a new subsite setting www.example.co.uk
  3. Configure LS Config CSS/JS/Page Cache settings to on.

Expected result

.htaccess file to not mention www.example.co.uk perhaps using references to HTTP_HOST if absolutely needed but avoid referencing hostname if it can. Not be modified regardless of subsites added / settings changed

Actual result

.htaccess file contains many incorrect references to subsite www.example.co.uk

# BEGIN NON_LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
### marker Network CSS/JS Auto Generation Rules start ###
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/https://www.example.co.uk/wp-content
RewriteRule ^([_0-9a-zA-Z-]+/)?(https://www.example.co.uk/wp-content/litespeed/cssjs/.*) $2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/https://www.example.co.uk/wp-content/litespeed/cssjs/.+\.(css|js)$
RewriteRule . /index.php [L]
### marker Network CSS/JS Auto Generation Rules end ###
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END NON_LSCACHE
# BEGIN LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
<IfModule LiteSpeed>
RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule \.object-cache\.ini - [F,L]

### marker CACHE RESOURCE start ###
RewriteRule https://www.example.co.uk/wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
### marker CACHE RESOURCE end ###

Notes

The code that seems to be responsible for generating the hostname elements of this is here: https://github.com/litespeedtech/lscache_wp/blob/1033fc0e8b54d5eb0f87e5946f2b5a68599762f6/src/htaccess.cls.php#L643

DeanMarkTaylor avatar Mar 19 '21 03:03 DeanMarkTaylor