开发者

Rewriting URL rule, example like StackOverflow

What would be the apache rewrite url to extract the id number (434376) from this url?

http://stackoverflow.com/questions/434376/unique-url-slug

something like

R开发者_开发技巧ewriteEngine On  
RewriteRule ^questions/([0-9]+)/?$([A-Za-z0-9-]+)   post.php?post_id=$1 [NC,L]  

...but it doesnt work on my site...any tips?

thanks


Tested:

RewriteRule ^questions/([0-9]+)/?.*$   rewrite.php?post_id=$1 [NC,L]


Well if the / is optional it probably should be:

RewriteRule ^questions/([0-9]+)/?([A-Za-z0-9-]+)?/?$   post.php?post_id=$1 [NC,L]

Let me know if it works..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜