.htaccess not enabled, Error 404 on pages, and Failure to load CSS & JS scripts

#1
1598588731832.png

Hello there Everyone: I am a complete newbie to openlitespeed server and i am having lots of issues with my WordPress website


1. As seen above, lots of scripts are not loading (especially minified js and css), i have since disabled and deleted the Litespeed plugin to see whether it will fix the error, but it is to no avail.

2. Asides the home page that loads (with the above error), any other link (page/post) throws an error 404 (the default openlitespeed 404 error page) but when i migrate the .htaccess content to virtual host level (rewrite tab), the pages are loaded but the number 1 problem listed above (with error 404 for js and css scripts).

3. When I change the permalink setting to plain, (no rule is written in the .hatcess), hence the 404 error for all pages except the homepage.

It is worth mentioning that i have wp staging plugin installed on the website (allows content and database duplication for staging environment) and everything works perfectly on it.



Here is the conetent of the .htaccess file: (I have disables and temporarily deleted the litespeed plugin)

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>



Here is the content of the server configuration file : /usr/local/lsws/conf/httpd_config.conf


Code:
#
# PLAIN TEXT CONFIGURATION FILE
#
#It not set, will use host name as serverName
serverName               
user                      www-data
group                     www-data
priority                  0
inMemBufSize              60M
swappingDir               /tmp/lshttpd/swap
autoFix503                1
gracefulRestartTimeout    300
mime                      conf/mime.properties
showVersionNumber         0
adminEmails               root@localhost

errorlog logs/error.log {
  logLevel                DEBUG
  debugLevel              0
  rollingSize             10M
  enableStderrLog         1
}

accesslog logs/access.log {
  rollingSize             10M
  keepDays                30
  compressArchive         0
}
#adminEmails                      root@localhost
indexFiles                index.html, index.php

expires  {
  enableExpires           1
  expiresByType           image/*=A604800,text/css=A604800,application/x-javascript=A604800,application/javascript=A604800,font/*=A604800,application/x-font-ttf=A604800
}
autoLoadHtaccess          1

tuning  {
  maxConnections          10000
  maxSSLConnections       10000
  connTimeout             300
  maxKeepAliveReq         10000
  keepAliveTimeout        5
  sndBufSize              0
  rcvBufSize              0
  maxReqURLLen            32768
  maxReqHeaderSize        65536
  maxReqBodySize          2047M
  maxDynRespHeaderSize    32768
  maxDynRespSize          2047M
  maxCachedFileSize       4096
  totalInMemCacheSize     20M
  maxMMapFileSize         256K
  totalMMapCacheSize      40M
  useSendfile             1
  fileETag                28
  enableGzipCompress      1
  compressibleTypes       text/*, application/x-javascript, application/xml, application/javascript, image/svg+xml,application/rss+xml
  enableDynGzipCompress   1
  gzipCompressLevel       6
  gzipAutoUpdateStatic    1
  gzipStaticCompressLevel 6
  brStaticCompressLevel   6
  gzipMaxFileSize         10M
  gzipMinFileSize         300

  quicEnable              1
  quicShmDir              /dev/shm
}

fileAccessControl  {
  followSymbolLink        1
  checkSymbolLink         0
  requiredPermissionMask  000
  restrictedPermissionMask 000
}

perClientConnLimit  {
  staticReqPerSec         0
  dynReqPerSec            0
  outBandwidth            0
  inBandwidth             0
  softLimit               10000
  hardLimit               10000
  gracePeriod             15
  banPeriod               300
}

CGIRLimit  {
  maxCGIInstances         20
  minUID                  11
  minGID                  10
  priority                0
  CPUSoftLimit            10
  CPUHardLimit            50
  memSoftLimit            1460M
  memHardLimit            1470M
  procSoftLimit           400
  procHardLimit           450
}

accessDenyDir  {
  dir                     /
  dir                     /etc/*
  dir                     /dev/*
  dir                     conf/*
  dir                     admin/conf/*
}

accessControl  {
  allow                   ALL
}

extprocessor lsphp {
  type                    lsapi
  address                 uds://tmp/lshttpd/lsphp.sock
  maxConns                35
  env                     PHP_LSAPI_CHILDREN=35
  env                     LSAPI_AVOID_FORK=200M
  initTimeout             60
  retryTimeout            0
  persistConn             1
  respBuffer              0
  autoStart               2
  path                    lsphp73/bin/lsphp
  backlog                 100
  instances               1
  priority                0
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           1400
  procHardLimit           1500
}

scripthandler  {
  add                     lsapi:lsphp php
}

railsDefaults  {
  maxConns                1
  env                     LSAPI_MAX_IDLE=60
  initTimeout             60
  retryTimeout            0
  pcKeepAliveTimeout      60
  respBuffer              0
  backlog                 50
  runOnStartUp            3
  extMaxIdleTime          300
  priority                3
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           500
  procHardLimit           600
}

wsgiDefaults  {
  maxConns                5
  env                     LSAPI_MAX_IDLE=60
  initTimeout             60
  retryTimeout            0
  pcKeepAliveTimeout      60
  respBuffer              0
  backlog                 50
  runOnStartUp            3
  extMaxIdleTime          300
  priority                3
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           500
  procHardLimit           600
}

nodeDefaults  {
  maxConns                5
  env                     LSAPI_MAX_IDLE=60
  initTimeout             60
  retryTimeout            0
  pcKeepAliveTimeout      60
  respBuffer              0
  backlog                 50
  runOnStartUp            3
  extMaxIdleTime          300
  priority                3
  memSoftLimit            2047M
  memHardLimit            2047M
  procSoftLimit           500
  procHardLimit           600
}

module cache {
  internal                1
#          1
checkPrivateCache   1
checkPublicCache    1
maxCacheObjSize     10000000
maxStaleAge         200
qsCache             1
reqCookieCache      1
respCookieCache     1
ignoreReqCacheCtrl  1
ignoreRespCacheCtrl 0

enableCache         0
expireInSeconds     3600
enablePrivateCache  0
privateExpireInSeconds 3600
  ls_enabled              1
}

virtualhost Example {
  vhRoot                  Example/
  configFile              $SERVER_ROOT/conf/vhosts/Example/vhconf.conf
  allowSymbolLink         1
  enableScript            1
  restrained              1
  setUIDMode              0
}

virtualhost wordpress {
  vhRoot                  /var/www/html
  configFile              /usr/local/lsws/conf/vhosts/wordpress/vhconf.conf
  allowSymbolLink         1
  enableScript            1
  restrained              0
  setUIDMode              2
}

listener Default {
  address                 *:8088
  secure                  0
  map                     Example *
}

listener wordpress {
  address                 *:80
  secure                  0
  map                     wordpress *, mywebsite.com, www.mywebsite.com
}

listener wordpressssl {
  address                 *:443
  secure                  1
  keyFile                 /usr/local/lsws/conf/example.key
  certFile                /usr/local/lsws/conf/example.crt
  map                      wordpress *, mywebsite.com, www.mywebsite.com
}

vhTemplate centralConfigLog {
  templateFile            conf/templates/ccl.conf
  listeners               Default
}

vhTemplate EasyRailsWithSuEXEC {
  templateFile            conf/templates/rails.conf
  listeners               Default
}



And here is the content of virtual host configuration file : /usr/local/lsws/conf/vhosts/wordpress/vhconf.conf



Code:
docRoot                   /var/www/html/

errorlog  {
  useServer               1
  logLevel                ERROR
}

index  {
  useServer               0
  indexFiles              index.php index.html
}

phpIniOverride  {

}

context / {
  location                $DOC_ROOT/html
  allowBrowse             1

  rewrite  {
    enable                1
    autoLoadHtaccess      1

  }
  addDefaultCharset       off

  phpIniOverride  {

  }
}

context /phpmyadmin/ {
  location                /var/www/phpmyadmin/
  allowBrowse             1
  indexFiles              index.php

  accessControl  {
    allow                 *
  }

  rewrite  {
    enable                0
    inherit               0

  }
  addDefaultCharset       off

  phpIniOverride  {

  }
}

context exp:^.*(css|gif|ico|jpeg|jpg|js|png|webp|woff|woff2|fon|fot|ttf)$ {
  location                $DOC_ROOT/$0
  allowBrowse             1
  enableExpires           1
  expiresByType           text/css=A15552000, image/gif=A15552000, image/x-icon=A15552000, image/jpeg=A15552000, application/x-javascript=A15552000, text/javascript=A15552000, application/javascript=A15552000, image/png=A15552000, image/webp=A15552000, font/ttf=A15552000, font/woff=A15552000, font/woff2=A15552000, application/x-font-ttf=A15552000, application/x-font-woff=A15552000, application/font-woff=A15552000, application/font-woff2=A15552000
  extraHeaders            <<<END_extraHeaders
unset Cache-control
set Cache-control public, max-age=15552000
set Access-Control-Allow-Origin: *
  END_extraHeaders


  rewrite  {

  }
  addDefaultCharset       off

  phpIniOverride  {

  }
}

rewrite  {
  enable                  1
  autoLoadHtaccess        1
  logLevel                9
}

Here is the error log: /usr/local/lsws/logs/error.log


Code:
2020-08-28 02:20:14.276505 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/pluginname/src/css/datepicker/date.min.css' with pattern '.*', result: 1
2020-08-28 02:20:14.276553 [INFO] [***-1#wordpress] [REWRITE] No substition
2020-08-28 02:20:14.276567 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/pluginname/src/css/datepicker/date.min.css' with pattern 'wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php', result: -1
2020-08-28 02:20:14.276571 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/pluginname/src/css/datepicker/date.min.css' with pattern '.?', result: 1
2020-08-28 02:20:14.276576 [INFO] [***-1#wordpress] [REWRITE] set cache vary on: 'wp-postpass_**********'
2020-08-28 02:20:14.276588 [INFO] [***-1#wordpress] [REWRITE] add ENV: 'Cache-Vary:wp-postpass_*********' 
2020-08-28 02:20:14.276592 [INFO] [***-1#wordpress] [REWRITE] No substition
2020-08-28 02:20:14.276595 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/pluginname/src/css/datepicker/date.min.css' with pattern 'favicon\.ico$', result: -1
2020-08-28 02:20:14.276599 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/pluginname/src/css/datepicker/date.min.css' with pattern '.*', result: 1
2020-08-28 02:20:14.276603 [INFO] [***-1#wordpress] [REWRITE] Cond: Match 'text/css,*/*;q=0.1' with pattern 'image/webp', result: -1
2020-08-28 02:20:14.276607 [INFO] [***-1#wordpress] [REWRITE] Cond: Match 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36' with pattern 'Page Speed', result: -1
2020-08-28 02:20:14.276611 [INFO] [***-1#wordpress] [REWRITE] Rule: Match '/wp-content/plugins/alidswoo/src/css/datepicker/date.min.css' with pattern '^(.*)$', result: 2
2020-08-28 02:20:14.276616 [INFO] [***-1#wordpress] [REWRITE] Cond: Match '{"scheme":"https"}' with pattern '"scheme":"http"', result: -1

Thank you for your help.
 

Attachments

Cold-Egg

Administrator
#2
Hi,

I guess you are migrating your own site to the OpenLiteSpeed WordPress Image server?
1. If you copy the .htaccess content to the new server, please restart lsws to load the rules.
Code:
service lsws restart
2. Optimized static file shows 404, please provide one of the static file URL so we can if this is a path issue
3. Whenever you change the permalink, try restarting the web server
 
#3
Hi,

I guess you are migrating your own site to the OpenLiteSpeed WordPress Image server?
1. If you copy the .htaccess content to the new server, please restart lsws to load the rules.
Code:
service lsws restart
2. Optimized static file shows 404, please provide one of the static file URL so we can if this is a path issue
3. Whenever you change the permalink, try restarting the web server

I am not sure about what the question : Migrate to OpenLiteSpeed WordPress Image server : mean but i did use the quic.cloud platform on Litespeed Plugin. I tried adding expire headers with the static context exp:^.*(css|gif|ico|jpeg|jpg|js|png|webp|woff|woff2|fon|fot|ttf)$.

1. I always do a graceful restart on webadmin panel whenever i do anything on .htacces / permalink (does this serve same purpose as the lsws restart code above?

2. Here is a static code URL : https://www.retailoks.com/wp-includes/css/dashicons.min.css?ver=5.5, it throws a 404 error, however with the server-IP, it works : http://34.89.77.102/wp-includes/css/dashicons.min.css?ver=5.5.

3. Sames as 1.

This whole ordeal started because i was trying to get a wordpress cloaking plugin (Hide My WP) to work, and it looked like the .htaccess wasn't parsed despite migrating to the Vhost rewrite and context level. My front-end layout was consistently broken before i gave up and deleted the plugin.
 

Cold-Egg

Administrator
#4
Hi,

OLS supports rewrite rule only, other rules will be ignored. So any cloaking plugin shouldn't cause the 404 issue. It's more like domain changing or caching issue to me. Please purge all cache after you change the domain on both LSCache plugin and Cloudflare. Hope it helps.

Best.
 
Top