htaccess与某些角色没有合作

This is my url rule:

RewriteRule ^([a-zA-Z0-9_=-]+)/([a-zA-Z0-9_=-]+)/?$ controller/$1/$1.php?id=$2 [L]

working fine with :http://yii.abc.com/category/Grand-Opening but no working with : http://yii.abc.com/category/I'm-sorry and

http://yii.abc.com/category/Wedding-&-ROM

That's because you haven't included characters ' and & in your character class.

You can fix it by including them like this.

Regex: ^([a-zA-Z0-9_=-]+)\/(['&a-zA-Z0-9_=-]+)\/?$

Regex101 Demo

Try this rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w=-]+)/([^/]+)/?$ controller/$1/$1.php?id=$2 [L,QSA,B]

Using B flag is the key here to be able to pass whole Wedding-&-ROM as GET parameter.