random 404 on mod_rewrite

Discussion in 'Bug Reports' started by piper, Jun 2, 2007.

  1. piper

    piper Well-Known Member


    I Run a wordpress site with mod_rewrite and it's installed on the root folder

    in subfolder i have a forum application and it has it's own htaccess for mod_rewrite

    It works but randomly gives 404 on the forum

    This is what the server have

    Litespeed Enterprise 3.11, PHP 5.2.2, LSPHP 4.0

    Htaccess is

    RewriteEngine On
    RewriteRule ^index\.html$ ./index.php?mdrw=on
    RewriteRule ^manual\.html$ ./index.php?action=manual&mdrw=on
    RewriteRule ^([0-9]+)_([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vthread&forum=$1&topic=$2&page=$3&mdrw=on
    RewriteRule ^([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on

    Any help?

    Thanks in advanced
  2. mistwang

    mistwang LiteSpeed Staff

    Are there rewrite rules in .htaccess of the root folder?

    Random error is hard to debug, and we need at least some debug log for request results in 404, with rewrite log enabled, in order to look it further. It might have something to do with htaccess cache updating.
    Is that possible to generate some debug log for analysis?

    One possible fix is to create a static context for the forum, and move the rewrite rule from .htaccess to the context level configuration, without changing the rewrite rules. But, if the random 404 is cause by a bug in htaccess handle, the bug will remain there.
  3. piper

    piper Well-Known Member

    i got this error

    [config:vhost:gear:context:/forums/] rewrite: invalid third parameter, '[' is expected while parsing: RewriteRule ^([0-9]+)_([0-9]+)_([-0-9]+)\.html$ ./index.php?action=vthread&forum=$1&topic=$2&page=$3 &mdrw=on
  4. piper

    piper Well-Known Member

    Can you guide me on how to make static context?

    the forum folder is at /home/user/gear/forums

    goes to /forums/

    (i tried creating static but dont know about the setting)

  5. mistwang

    mistwang LiteSpeed Staff

    There is a space in between "...&page=$3 &mdrw=on".
  6. mistwang

    mistwang LiteSpeed Staff

    Maybe 404 is caused by the error in rewrite rule? that rule does not get in.
  7. piper

    piper Well-Known Member

    hmm i'm not sure since it only happend randomly, if i refresh the page after 404 it shows up fine

    can you guide me on how to create static context with the mod_rewrite rule? i still dont get how it works :p
  8. piper

    piper Well-Known Member

    i switch back to apache 2 and the random 404 went away, no problem at all.

    any other pointer? thanks
  9. mistwang

    mistwang LiteSpeed Staff

    If you are using LiteSpeed + hosting control panel, you maybe not able to add static context, as the site is configured through Apache httpd.conf. It will need your assist if it is caused by a bug.

    How often does it happen?
  10. piper

    piper Well-Known Member

    every 20-30 clicks on different url of the mod_rewrite

    i'm ready to assist :)

    the forum is located here


    to reproduce just surf around the forum (browsing forum categories and forum topics back and forth) after 20-30 clicks it will give 404 error
    Last edited: Jun 2, 2007
  11. mistwang

    mistwang LiteSpeed Staff

    First, you need to set "RewriteLogLevel 9" to turn on rewrite log for that vhost.
    Next, clicking "Enable debug logging" from LSWS control panel, to turn on debug logging, click again will turn it off.
    Go to your site and click around, until you produce a few 404 pages, turn dbug logging off. then send lsws/logs/error.log to bug ((a)) litespeedtech ((.)) com.
  12. piper

    piper Well-Known Member

    sent, thank you :)
  13. mistwang

    mistwang LiteSpeed Staff

  14. piper

    piper Well-Known Member

    flawless, amazing, you guys are simply amazing, thanks a lot :)
  15. pguy

    pguy Active Member

    A similar problem here, a ton of 404s on wordpress. I am trying out the enterprise version. How can I best update to 3.1.2, which is linked about but not listed in the downloads? I am currently using 3.1.1

  16. mistwang

    mistwang LiteSpeed Staff

    Please update to 3.1.2 for the fix.
  17. ts77

    ts77 Well-Known Member

    I guess he meant that the download-page is still listing 3.1.1 as the latest version ;).
  18. pguy

    pguy Active Member

    Yes, that was my concern .. the 404s seem to have stopped!
  19. mistwang

    mistwang LiteSpeed Staff

    We will skip 3.1.2 and release 3.2 soon, that's just for some one need a fix for the 404 problem.

Share This Page