OpenLiteSpeed/myBB vs Friendly URL's

Discussion in 'General OpenLiteSpeed Discussion' started by Tracy Perry, Mar 27, 2014.

  1. Tracy Perry

    Tracy Perry Active Member

    OK... got the friendly URLS working on my XenForo and WP sites... but myBB is another matter.

    My rewrite is the standard one provided by myBB:
    RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
            RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]
            RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
            RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
            RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
            RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
            RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
            RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
            RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]
            RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]
            RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]
            RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]
            RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
            RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
            RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
            RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
            RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]
            RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]
    and the results are:
    2014-03-27 01:42:24.779    INFO    [] [REWRITE] Rule: Match '/forum-4.html' with pattern '^forum-([0-9]+)\.html$', result: -1
    2014-03-27 01:42:24.779    INFO    [] [REWRITE] Rule: Match '/forum-4.html' with pattern '^forum-([0-9]+)-page-([0-9]+)\.html$', result: -1
    2014-03-27 01:42:24.779    INFO    [] [REWRITE] Rule: Match '/forum-4.html' with pattern '^thread-([0-9]+)\.html$', result: -1
    With the friendly URL's enabled the result is and without it they are

    It looks like they are NOT taking (result: -1)? Any suggestions (the forum does try to redirect to the SEO friendly URL just displays a 404 Not Found error.

    I have also tried with the Google SEO plugin and rewrites of:
    # Google SEO workaround for search.php highlights:
    # Make this rule the first rewrite rule in your .htaccess!
    RewriteRule ^([^&]*)&(.*)$$1?$2 [L,QSA,R=301]
    # Google SEO 404:
    ErrorDocument 404 /misc.php?google_seo_error=404
    # Google SEO Sitemap:
    RewriteRule ^sitemap\-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]
    # Google SEO URL Forums:
    RewriteRule ^Forum\-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]
    # Google SEO URL Threads:
    RewriteRule ^Thread\-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]
    # Google SEO URL Announcements:
    RewriteRule ^Announcement\-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]
    # Google SEO URL Users:
    RewriteRule ^User\-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]
    # Google SEO URL Calendars:
    RewriteRule ^Calendar\-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]
    # Google SEO URL Events:
    RewriteRule ^Event\-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]
    and same problem.

    MyBB shows in address bar (without SEO it would show

    Debug in OLS log shows:
    2014-03-27 01:51:08.469    INFO    [] [REWRITE] Rule: Match '/Forum-xBox' with pattern '^Forum\-([^./]+)$', result: -1
    2014-03-27 01:51:08.469    INFO    [] [REWRITE] Rule: Match '/Forum-xBox' with pattern '^Thread\-([^./]+)$', result: -1
    I had it working fine with nginx.
    Last edited: Mar 27, 2014
  2. lsmichael

    lsmichael Active Member

    Howdy Tracy,

    Correct me if I'm wrong, but this looks like the issue I spoke about in this thread:

    Namely, these rewrite rules are written for .htaccess files and not virtual hosts. A rule in an .htaccess file assumes the filesystem path up to the directory with the .htaccess rule. A rule in a virtual host looks for a pattern in the URL after the hostname. The key difference is that the pattern in the URL starts with "/".

    Mostly all you have to do is put "/" at the start of things like "showthread.php" so that the rewrite engine recognizes them in the URL.

    That's the solution for now, but this is certainly a pain. We will make it easier to transfer your rewrites to OpenLiteSpeed. I can't say how yet. (Recently, OpenLiteSpeed development has been pretty consumed by work on the API for third party modules.) We will do something to make this easier, though.

    Tracy Perry likes this.
  3. Tracy Perry

    Tracy Perry Active Member

    Bingo! Thanks @lsmichael, that solved the problem. I knew it was probably something simple but couldn't find it doing a google search. The built in friendly works with it now.
    Now it's time to go to work on the Google SEO one.

Share This Page