OpenLitespeed Wordpress 404 permalink

April 22, 2019 795 views
WordPress Ubuntu 18.04

Hi

For the past two days I have been going over and over why my website is getting 404 error on permalinks for %postname%.

A bit of background:

Migrating a Wordpress site from Ubuntu WordPress on 18.04 to Litespeed Ubuntu WordPress on 18.04.

Main home page is working, but if I click any link with the permalink as as above I get:

"404 Not Found The resource requested could not be found on this server!" - Proudly powered by LiteSpeed Web Server

If the permalink is set back to 'plain', everything works.

With this in mind and from everything I have read over the last few days it is a rewrite rule issue with .htaccess. If it was apache running there is plenty of documentation about how to fix, but I have not found anything that works for Openlitespeed.

.htaccess file below

# 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 ^min/\w+\.(css|js) - [E=cache-control:no-vary]

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

### marker LOGIN COOKIE start ###
RewriteRule .? - [E="Cache-Vary:wp-postpass_c551aee75d8679e81f4ab299e8db01d5"]
### marker LOGIN COOKIE end ###

### marker FAVICON start ###
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
### marker FAVICON end ###
DisableCgiOverride On
</IfModule>
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END LSCACHE
# BEGIN NON_LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
### marker MINIFY start ###
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+)\.(css|js)$
RewriteCond %1/wp-content/cache/$2/$1.$2 -f
RewriteRule min/(\w+)\.(css|js) wp-content/cache/$2/$1.$2 [L]
</IfModule>
### marker MINIFY end ###

## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END NON_LSCACHE
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

#Tried adding the below into see same would apply from apache...

# BEGIN LiteSpeed
<IfModule Litespeed>
SetEnv noabort 1
AllowOverride FileInfo
DisableCgiOverride On
</IfModule>
# END LiteSpeed

<Directory /var/www/html>
 Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>


Any help would be great, at the moment I have reverted back to old droplet until this is resolved.

2 Answers

I have had the same problem, but restarting the service didn't do anything for me.

Hi,

Could you try this command to restart web server (no down time) after permalink set to post name?

sudo service lsws restart

Please let us know if it works. Thanks.

Have another answer? Share your knowledge.