Mod_rewrite 与任何 utf8 字符
我需要使用这种格式的链接: http://site.com/index (或 /index-blahblah 或 /index1 或 /index1-blahblah )
其中 blahblah 可以包含任何 UTF 8 字符
我在下面编写了规则,但它不起作用......请帮忙!
AddDefaultCharset UTF-8
RewriteRule ^/?(index|index1)-?(.*)$ main.php?page=$1&keyword=$2 [NC,B,L]
如果我输入一个范围,它确实有效...但不能使用“.”
RewriteRule ^/?(index|index1)-*([A-Z]*)$ main.php?page=$1&keyword=$2 [NC,B,L]
I need to use links in this format:
http://site.com/index
(or /index-blahblah or /index1 or /index1-blahblah )
where blahblah can contain any UTF 8 character
I wrote the rule below but it doesn't work....please help!
AddDefaultCharset UTF-8
RewriteRule ^/?(index|index1)-?(.*)$ main.php?page=$1&keyword=$2 [NC,B,L]
It does work if I put a range ...but not with '.'
RewriteRule ^/?(index|index1)-*([A-Z]*)$ main.php?page=$1&keyword=$2 [NC,B,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
domain.com/category-name/ 到domain.com/categories.php?name=category-name
RewriteRule ^([A-Za-z0-9-]+)/?$categories.php?name=$1 [L]
我认为这个例子可能会有所帮助。
domain.com/category-name/ to domain.com/categories.php?name=category-name
RewriteRule ^([A-Za-z0-9-]+)/?$ categories.php?name=$1 [L]
I think this example might help.