Editing wrong .htaccess when site and WP address differ
The plugin is editing the .htaccess file at the Wordpress installation address instead of the actual website address. For example, if WP is installed to a subdirectory called "blog", the plugin is writing to "public_html/blog/.htaccess" even though the site address is one directory up. This then results in a nonsensical rule like:
RewriteRule blog/wp-content/...
This is incorrect because the rewrite base defaults to the directory where the .htaccess file resides. I'm getting response headers of:
x-litespeed-cache: miss
When I copy the block to the correct file, I get Hit as expected.
Couldn't immediately find in the code where this is going wrong (confused by the frontend and backend variables). In any case, I'd suggest making use of the WP home_url() function for determining the correct .htaccess to write to, and then using the WP content_url() function when forming the RewriteRule in case someone has relocated that directory.
On second thought, you could use the get_home_path() function:
$htaccessFile = get_home_path() . '.htaccess'
This function returns the path without the subfolder as desired.
Hi! It seems that this issue is still not fixed. I am having the problem on my non default WP setups. Is there any idea when this will be fixed?
Looking around in the LS cache plugin settings I found the option for setting the correct path. Great.
.htaccess Path Settings – the auto detect should work fine. Specifying the path is usually not necessary unless you have your site in some non-standard directory or using non-standard htaccess file name.
@steverep It looks like you can close this issue.