简体   繁体   English

使用重写mod创建一个友好的URL

[英]create a friendly url using the rewrite mod

im trying to create a friendly url using the rewrite mod in php with no sucess! 即时通讯尝试使用php中的重写mod创建一个友好的URL,没有成功!

without the friendly url 没有友好的网址

http://www.mywebsite.com/lyrics/index.php?letter=a

with the friendly url 友好的网址

http://www.mywebsite.com/lyrics/a/

my attempt with no success: 我的尝试没有成功:

RewriteRule ^lyrics/([A-Z])/?$ /index.php?letter=$1 [L]

help! 救命!

Are you always expecting an uppercase letter? 你总是期待一个大写字母吗? If not, I would add the case-insensitive flag NC as below: 如果没有,我会添加不区分大小写的标志NC如下:

RewriteRule ^lyrics/([A-Z])/?$ /index.php?letter=$1 [NC,L]

ok, got it... i was missing something(the one thing showing in bold below) + added rexmac tip... 好吧,明白了...我遗失了一些东西(下面用粗体显示的一件事)+添加了rexmac提示......

RewriteRule ^lyrics/([az])/?$ / lyrics /index.php?letter=$1 [NC,L] RewriteRule ^ lyrics /([az])/?$ / lyrics /index.php?letter=$1 [NC,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM