bear
bear

Reputation: 11615

htaccess rewrite rule doesn't work with dashes?

my htaccess rule isn't working with rewrite with dashes in:

RewriteRule ^([A-Za-z]+)$ index.php?do=$1 [QSA]

so, www.domain.com/rules works, however, www.domain.com/about-us doesn't

I've verified that www.domain.com/index.php?do=about-us works so it's definately a rewrite issue.

Thanks.

Upvotes: 0

Views: 1922

Answers (2)

Amirshk
Amirshk

Reputation: 8258

Your regex only takes a-z and A-Z, change it to [A-Za-z\-] so it will include the - character

Upvotes: 5

richsage
richsage

Reputation: 27102

Your regular expression doesn't include a check for dashes - try:

RewriteRule ^([A-Za-z\-]+)$ index.php?do=$1 [QSA]

Upvotes: 6

Related Questions