[Resolved] 404 errors after update to 5.0.2 - has to do with mod_rewrite

Status
Not open for further replies.

jdeg

Active Member
#1
After I update to 5.0.2 from 4.2.19 I'm getting 404 errors on all pages that have rewritten URLs. I use WHM and the the rewrite rules are in the Pre VirtualHost Include file.

Any ideas?
 

Pong

Administrator
Staff member
#2
Check error log to see why 404 happened. If you believe they were caused by rewrite rule, turn on rewrite log(set to higher level) to see detailed errors.
 

jdeg

Active Member
#3
I checked the error logs and all they say is that there are not found errors. It's like the rewrite rules aren't being applied at all. I see that the file is being loaded by litespeed when it starts though.
 

Pong

Administrator
Staff member
#4
Include file is ok. Need to make sure rewrite engine on. And apply to right directory of virtual host. Try to place them inside of virtual host of Apache configuration file ( may need include file for cPanel for such customization) or try to move them to .htaccess file of related directory to see how it's going.

You can also test if Apache works. How about LSWS 4.2.24?
 

jdeg

Active Member
#6
I believe the "Fixed a regression in rewrite engine that broke some existing rewrite rules when upgrading from LSWS 4.2.x." that was fixed in 5.0.3 solved the issue I was having.

Everything now works correctly in 5.0.4.
 

jdeg

Active Member
#7
This exact error has popped up again when going from 5.0.7 to 5.0.10, I just tried to go to 5.0.12, and it still happened.

Any ideas?
 

mistwang

LiteSpeed Staff
#8
After I update to 5.0.2 from 4.2.19 I'm getting 404 errors on all pages that have rewritten URLs. I use WHM and the the rewrite rules are in the Pre VirtualHost Include file.
You want those rewrite rules to be applied to all vhosts?
We nee to know how the rewrite rule was configured? in a <Directory ...> context or not.
Can you give us the content as-is in your Pre VirtualHost Include?
 

jdeg

Active Member
#9
You want those rewrite rules to be applied to all vhosts?
We nee to know how the rewrite rule was configured? in a <Directory ...> context or not.
Can you give us the content as-is in your Pre VirtualHost Include?
The rules are contained in the apache pre_virtualhost_2.conf file. The directory is specified before each set of rules.

i.e.
<Directory /home/site/public_html>

RewriteEngine On
...
 

mistwang

LiteSpeed Staff
#10
Please force update to the latest build 5.0.12, run command

/usr/local/lsws/admin/misc/lsup.sh -f -v 5.0.12

If it is not fixed, we need one example of such configuration. Is the directory the same as a vhost public_html directory? a sub directory under public_html? or it is above all accounts, like "/home"? We need to know how it is configured.
 

jdeg

Active Member
#11
Please force update to the latest build 5.0.12, run command

/usr/local/lsws/admin/misc/lsup.sh -f -v 5.0.12

If it is not fixed, we need one example of such configuration. Is the directory the same as a vhost public_html directory? a sub directory under public_html? or it is above all accounts, like "/home"? We need to know how it is configured.
Unfortunately forcing the update still results in 404 errors on pages that are rewritten.

This is a cpanel/WHM install, so public_html is under all accounts like /home/site/public_html. Regardless there are only two site that have rewrite rules in the pre_virtualhost_2.conf file.
 

jdeg

Active Member
#13
So your configuration is like


I need an example exactly matching your configuration.
Here is one:
Code:
<Directory /home/site/public_html>

<FilesMatch "\.(gif¦jpe?g¦png¦ico¦css¦js¦swf)$">
Header set Cache-Control "public"
</FilesMatch>
<FilesMatch "\.(ico)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>

# START E-Tag
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None
# END E-Tag

# START Deny attempts to view the Htaccess file.
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
# END Deny attempts to view the Htaccess file.

# Start Deny attempts to view the config file.
<Files includes/config.php>
Order allow,deny
Deny from all
</Files> 
# End Deny attempts to view the config file.

# START Max Age
<FilesMatch "\.(gif|png|jpg)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
# END Max Age

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "private"
  </filesMatch>
  <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "private, must-revalidate"
  </filesMatch>
</ifModule>
# END Cache-Control Headers

# Block User-agent Libwww-perl

RewriteEngine On

Options +FollowSymLinks

RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]

RewriteCond %{HTTP_HOST} !^site\.com
RewriteRule (.*) http://site.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^site\.com\/gallery\/
RewriteRule (.*) http://site.com/gallery/$1 [R=301,L]

RewriteRule ^showimage\.php(.*) /gallery/showimage\.php$1 [R=301,L]
RewriteRule ^browseimages\.php(.*) /gallery/browseimages\.php$1 [R=301,L]
RewriteRule ^upload\.php(.*) /gallery/upload\.php$1 [R=301,L]
RewriteRule ^moderate\.php(.*) /gallery/moderate\.php$1 [R=301,L]
RewriteRule ^editimage\.php(.*) /gallery/editimage\.php$1 [R=301,L]
RewriteRule ^managecats\.php(.*) /gallery/managecats\.php$1 [R=301,L]
RewriteRule ^gallery/vbshout\.php(.*) /vbshout\.php$1 [R=301,L]
RewriteRule ^gallery/ckeditor\.php(.*) /ckeditor\.php$1 [R=301,L]

RewriteCond %{REQUEST_URI} !(admincp/|dbseocp/|modcp/|cron|mobiquo|forumrunner|api\.php|reviewpost/|classifieds/|photopost/|gallery/|products/)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ dbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|dbseocp|modcp|clientscript|cpstyles|images|reviewpost|classifieds|photopost|gallery|products)/
RewriteRule ^(.+)$ dbseo.php [L,QSA]

</Directory>
 
Status
Not open for further replies.
Top