MyBB Community Forums

Full Version: Problem in all URLs with Google Seo and Lighttpd that has "&" !!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am on latest mybb , problem seems to be from lighttpd rewriting rules of Google SEO, maybe someone can help

Everything is working fine except search results URLs which has "&" of each URL which gives invalid response but it's supposed to be "?" instead and here is the log:

2021-02-19 17:12:43: (mod_rewrite.c.282) mod_rewrite invalid result (not beginning with '/') while processing uri: /forum/Thread-P0401-Exhaust-Gas-Recirculation-A-Flow-Insufficient-Detected&highlight=p0401


my lighttpd rules:
url.rewrite = (
"^/forum/([^&?]*)&([^?]*)$" => "https://example.com/forum/$1?$2",
"^/forum/([^&?]*)&([^?]*)\?(.*)$" => "https://example.com/forum/$1?$2&$3",
"^/forum/((?i)sitemap-([^./?]+)\.xml)(\?(.*)|)$" => "/forum/misc.php?google_seo_sitemap=$2&$4",
"^/forum/((?i)Forum-([^./?]+))(\?(.*)|)$" => "/forum/forumdisplay.php?google_seo_forum=$2&$4",
"^/forum/((?i)Thread-([^./?]+))(\?(.*)|)$" => "/forum/showthread.php?google_seo_thread=$2&$4",
"^/forum/((?i)Announcement-([^./?]+))(\?(.*)|)$" => "/forum/announcements.php?google_seo_announcement=$2&$4",
"^/forum/((?i)User-([^./?]+))(\?(.*)|)$" => "/forum/member.php?action=profile&google_seo_user=$2&$4",
"^/forum/((?i)Calendar-([^./?]+))(\?(.*)|)$" => "/forum/calendar.php?google_seo_calendar=$2&$4",
"^/forum/((?i)Event-([^./?]+))(\?(.*)|)$" => "/forum/calendar.php?action=event&google_seo_event=$2&$4",
)

Problem is with search results having &highlight instead of ?highlight=

maybe anyone have solution for this problem

Thanks Smile
wrong config, the first two go to url.redirect
(2021-02-19, 08:07 PM)frostschutz Wrote: [ -> ]wrong config, the first two go to url.redirect

Problem is fixed now no invalid responses but highlight function is not working.

When I search for anything results URLs have &highlight instead of ?highlight so when I enter URL it enters but removes &highlight and function doesn't work unless I put it manually in URL
well, your site is redirecting incorrectly

maybe something changed about how redirects work in lighttpd

maybe cloudflare is interfering with the redirect and removing query string

other possible ways to fix:

change MyBB's default URL scheme (showthread.php?tid=123 -> thread-123.html)

change MyBB's code to append parameters properly instead of this:

        // Work out if we have terms to highlight
        $highlight = "";
        if($search['keywords'])
        {
                if($mybb->seo_support == true)
                {
                        $highlight = "?highlight=".urlencode($search['keywords']);
                }
                else
                {
                        $highlight = "&highlight=".urlencode($search['keywords']);
                }
        }

MyBB blindly appends either ? or & to the URL w/o checking the URL itself so you get either & instead of ? or ? instead of &.

This is where Google SEO as a mere plugin hits limitations of MyBB codebase.
(2021-02-20, 09:52 AM)frostschutz Wrote: [ -> ]well, your site is redirecting incorrectly

maybe something changed about how redirects work in lighttpd

maybe cloudflare is interfering with the redirect and removing query string

other possible ways to fix:

change MyBB's default URL scheme (showthread.php?tid=123 -> thread-123.html)

change MyBB's code to append parameters properly instead of this:

        // Work out if we have terms to highlight
        $highlight = "";
        if($search['keywords'])
        {
                if($mybb->seo_support == true)
                {
                        $highlight = "?highlight=".urlencode($search['keywords']);
                }
                else
                {
                        $highlight = "&highlight=".urlencode($search['keywords']);
                }
        }

MyBB blindly appends either ? or & to the URL w/o checking the URL itself so you get either & instead of ? or ? instead of &.

This is where Google SEO as a mere plugin hits limitations of MyBB codebase.

Hi, problem is only in search results which displays all URLs with &highlight= and enters thread normally without highlighting out the text. If I place manually ?=highlight at end of url it will highlight the text. Problem seems to be with lighttpd rewriting rules because it redirects to the thread and removes &highlight from URL. so is there is a way to replace &highlight= with ?highlight=

 thanks very much Smile
I am having same problem

Server Error in '/' Application.
A potentially dangerous Request.Path value was detected from the client (&).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (&).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (&).]
System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +11986128
System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +52