Error After Setting Permalinks
-
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!
-
Hi,
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
?p=[0-9]+&name=[^/]+/attachment/([^/]+)/?$
And that question mark at the beginning is causing the problem.
$match = str_replace(‘?p=’, ‘\?p=’, $match);
- The topic ‘Error After Setting Permalinks’ is closed to new replies.