可能的重复:
正则应该逃脱哪些字面角色?
RewriteRule ^profile/[A-Za-z_-d^.]/*$ ./index.php?page=showuser&username=$1
我是Mod重写的新手。有人可以告诉我这里的模式怎么了吗?我只是想让名称通过其中具有字符,数字, - , ^,_和。符号,但是当我使用该语法时,它会给我一个错误。
4件:
- 在开始时缺少斜线
- 您在角色类之后忘记了
+
:) - 您还忘记了捕获用户名:p
- 您应该始终将
-
字符放在班级的caracter类中
(另外,您不需要逃脱字符类内的]
以外的任何东西)
RewriteRule ^/profile/([-A-Za-z_d^.]+)/*$ ./index.php?page=showuser&username=$1
尝试
RewriteRule ^profile/([wd.^_-]+)/?$ ./index.php?page=showuser&username=$1
最好使用
RewriteRule ^profile/([wd.^_-]+)/?$ /index.php?page=showuser&username=$1
如果您的index.php文件在您的公共文件夹的顶部(根)中。