In some cases you may encounter missing files: images, CSS, or JS files.
All those missing files are processed by the current bootstrap: index.php.
If the session is set to regenerate on each request, as a normal security measure, the currently logged-in user is logged off, because the session ID is different now.
To avoid this, below the following line:
RewriteEngine On
add the line:
RewriteCond %{REQUEST_FILENAME} (\.gif|\.jpg|\.png|\.css|\.js)$
Save, and don't forget to test.
Frequently Asked Questions
What problem does this fix address? +
When missing static files (images, CSS, JS) are routed through the bootstrap (index.php) and the session is set to regenerate on each request, the currently logged-in user gets logged off because the session ID changes.
What is the fix? +
Below the "RewriteEngine On" line, add a RewriteCond matching file extensions like .gif, .jpg, .png, .css, and .js, so requests for those files are not routed through the bootstrap.