Error After Setting Permalinks (3 posts)

  1. Snailbird
    Posted 7 years ago #

    Hey all, I recently decided to completely revamp my freelance site and that included changing the permalinks. Now I changed them fine for my blog site with no issues, but I when I attempted to do the same for my separate design domain, I got the following errors showing up at the top of every page:

    Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/snailbir/public_html/designcoyote.com/wp-includes/classes.php on line 210

    Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in /home/snailbir/public_html/designcoyote.com/wp-includes/classes.php on line 211

    On some pages, it's just these two, but on other pages, the error messages duplicate twice. Once I change the permalinks structure back to the default, the messages go away. I have no clue what I did wrong, and I'm pretty sure I didn't touch the classes.php files and that it's the same for both my blog and the design site.

    Anyone have any solutions or did I forget a step that I'm going to kick myself for later? Thanks in advance!

  2. GreatFrenchSongs
    Posted 6 years ago #


    I got the same problem on my Windows development machine after downloading the code from my linux server. Also after enabling permalinks (although this could be a coincidence).

    The problem is caused when values in the $match variable around the lines 210 and 211 in classes.php begin with a question mark. As the ? is not escaped, the preg_match function expects the ? to relate to the previous character, which doesn't exist.

    I've not analysed it too much because it's just my development machine that goes wrong, but I solved it in dev by adding this line of code above the foreach statement on line 210

    $match = str_replace('?', '\?', $match);

    I believe this is what the $match variable should hold in anycase - escaped question marks where they are part of the URL being searched for. For example one of the $match values is


    And that question mark at the beginning is causing the problem.

  3. nanfch
    Posted 6 years ago #

    $match = str_replace('?p=', '\?p=', $match);

Topic Closed

This topic has been closed to new replies.

About this Topic