Invalid rewrite directive

curious

New Member
#1
Hi, i have problem with htaccess rewrite

Code:
ERROR    Invalid rewrite directive: CacheLookup on
2019-01-03 04:50:21.027546    ERROR    Invalid rewrite directive: ExpiresActive on
2019-01-03 04:50:21.027549    ERROR    Invalid rewrite directive: ExpiresByType application/pdf A2592000
2019-01-03 04:50:21.027553    ERROR    Invalid rewrite directive: ExpiresByType image/x-icon A2592000
2019-01-03 04:50:21.027556    ERROR    Invalid rewrite directive: ExpiresByType image/vnd.microsoft.icon A2592000
2019-01-03 04:50:21.027559    ERROR    Invalid rewrite directive: ExpiresByType image/svg+xml A2592000
2019-01-03 04:50:21.027562    ERROR    Invalid rewrite directive: ExpiresByType image/jpg A2592000
2019-01-03 04:50:21.027565    ERROR    Invalid rewrite directive: ExpiresByType image/jpeg A2592000
2019-01-03 04:50:21.027568    ERROR    Invalid rewrite directive: ExpiresByType image/png A2592000
2019-01-03 04:50:21.027571    ERROR    Invalid rewrite directive: ExpiresByType image/gif A2592000
2019-01-03 04:50:21.027574    ERROR    Invalid rewrite directive: ExpiresByType image/webp A2592000
2019-01-03 04:50:21.027577    ERROR    Invalid rewrite directive: ExpiresByType video/ogg A2592000
2019-01-03 04:50:21.027580    ERROR    Invalid rewrite directive: ExpiresByType audio/ogg A2592000
2019-01-03 04:50:21.027583    ERROR    Invalid rewrite directive: ExpiresByType video/mp4 A2592000
2019-01-03 04:50:21.027586    ERROR    Invalid rewrite directive: ExpiresByType video/webm A2592000
2019-01-03 04:50:21.027589    ERROR    Invalid rewrite directive: ExpiresByType text/css A2592000
2019-01-03 04:50:21.027592    ERROR    Invalid rewrite directive: ExpiresByType text/javascript A2592000
2019-01-03 04:50:21.027595    ERROR    Invalid rewrite directive: ExpiresByType application/javascript A2592000
2019-01-03 04:50:21.027598    ERROR    Invalid rewrite directive: ExpiresByType application/x-javascript A2592000
2019-01-03 04:50:21.027601    ERROR    Invalid rewrite directive: ExpiresByType application/x-font-ttf A2592000
2019-01-03 04:50:21.027604    ERROR    Invalid rewrite directive: ExpiresByType application/x-font-woff A2592000
2019-01-03 04:50:21.027608    ERROR    Invalid rewrite directive: ExpiresByType application/font-woff A2592000
2019-01-03 04:50:21.027611    ERROR    Invalid rewrite directive: ExpiresByType application/font-woff2 A2592000
2019-01-03 04:50:21.027614    ERROR    Invalid rewrite directive: ExpiresByType application/vnd.ms-fontobject A2592000
ERROR [Module-Cache] createEntry failed.
My configuration:


Code:
Rewrite Control
Enable Rewrite    Yes
Auto Load from .htaccess    Yes
Log Level    0
Now my website has "Error establishing a database connection", the settings in my wp-config are correct . Can anyone help solve this error?

Thank you.
 

David

Active Member
#2
The "invalid rewrite directive" is because openlitespeed does not support these rewrite directive.
But "Error establishing a database connection" maybe other reason. Such as lsphp does not have the mysql support, then you may need to build it youself.
How did you install openlitespeed?

Thanks.
David
 

curious

New Member
#3
I install openlitespeed from digitalocean one clicks app. Is there a solution that I have to do? I am a newbie. Thanks.
 
#5
Hello,

I also have 'Invalid rewrite directive: ExpiresByType...' in the 'Server Error Log' section. These directives are created by the LSCache pulgin in the .htaccess

So, to solve it I have to create a static context with 'ExpiresByType'?

That is to say:

Admin Control Panel -> Virtual Host -> MyVirtualHost -> Context Tab -> Add -> Type: Static

URI: /
Location: $VH_ROOT/html/
Accessible: Yes
Enable Expires: Yes
Expires by type: application/pdf A2592000, image/x-icon A2592000, image/svg+xml A2592000, etc.

Would this work?

I have in the 'Rewrite' tab:

Enable Rewrite: Yes
Rewrite Rules: rewriteFile /usr/local/lsws/TyV/html/.htaccess

Thanks!
 
#7
Checked, it works!
You just have to add '=' between the MIME-Type and the time, That is to say

Admin Control Panel -> Virtual Host -> MyVirtualHost -> Context Tab -> Add -> Type: Static

URI: /
Location: $VH_ROOT/html/
Accessible: Yes
Enable Expires: Yes
Expires by type: application/pdf=A2592000, image/x-icon=A2592000, image/svg+xml=A2592000, etc.

And of course remove the .htaccess Expiresbytype.

Thanks!
 
Top