Php 重写URL规则,例如StackOverflow

Php 重写URL规则,例如StackOverflow,php,apache,Php,Apache,从这个url中提取id号(434376)的apache重写url是什么 http://stackoverflow.com/questions/434376/unique-url-slug 差不多 RewriteEngine On RewriteRule ^questions/([0-9]+)/?$([A-Za-z0-9-]+) post.php?post_id=$1 [NC,L] …但它在我的网站上不起作用…有什么建议吗 感谢测试: RewriteRule ^questions/

从这个url中提取id号(434376)的apache重写url是什么

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

RewriteEngine On  
RewriteRule ^questions/([0-9]+)/?$([A-Za-z0-9-]+)   post.php?post_id=$1 [NC,L]  
…但它在我的网站上不起作用…有什么建议吗

感谢测试:

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

如果/是可选的,那么它可能应该是:

RewriteRule ^questions/([0-9]+)/?([A-Za-z0-9-]+)?/?$   post.php?post_id=$1 [NC,L]
让我知道它是否有效