Title: Rewrite rules &amp; entities
Last modified: August 22, 2016

---

# Rewrite rules & entities

 *  [andytela](https://wordpress.org/support/users/andymoonshine/)
 * (@andymoonshine)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/rewrite-rules-entities/)
 * HI
 * I have a bizarre error with the rewrite rules basically my rule should say this
 * `[cases/sectors/([^/]*)/?$] => index.php?post_type=cases&sectors=$matches[1]`
   
   But instead it comes out like this
 * `[cases/sectors/([^/]*)/?$] => index.php?post_type=cases§ors=$matches[1]`
 * Basically &sect in the url is changing to the entity §
 * Anyone come across this & how would I stop this from occurring?
 * Cheers
    Andy

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [andytela](https://wordpress.org/support/users/andymoonshine/)
 * (@andymoonshine)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/rewrite-rules-entities/#post-5696925)
 * Fixed it using htmlspecialchars
 * Cheers
    Andy
 *  Thread Starter [andytela](https://wordpress.org/support/users/andymoonshine/)
 * (@andymoonshine)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/rewrite-rules-entities/#post-5697106)
 * Actually the above fix didn’t work
    Even though outputting the results of the
   rules it looked correct somewhere along the line it must convert it again
 * I got around it by changing the order of my query to
    `[cases/sectors/([^/]*)/?
   $] => index.php?sectors=$matches[1]&post_type=cases` So the ampersand didn’t 
   appear next to the word sect and create an entity
 * Obviously this worked for my case but there must be other times when it’s not
   possible to not have an ampersand next to a word that will create an html entity
 * Cheers
    Andy

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Rewrite rules & entities’ is closed to new replies.

## Tags

 * [rules](https://wordpress.org/support/topic-tag/rules/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [andytela](https://wordpress.org/support/users/andymoonshine/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/rewrite-rules-entities/#post-5697106)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
