正则表达式,modrewrite php apache

时间:2011-05-19 14:49:41

标签: php apache

可以掩饰这个:

www.site.com/latest_news/10518271191304876236

到这个

www.site.com/latest_news /

但我仍然需要使用PHP访问'10518271191304876236'这部分作为ID使用。

非常感谢

1 个答案:

答案 0 :(得分:0)

你可以像这样拥有.htaccess:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteRule ^(latest_news/)(.+)/?$ /$1?ID=$2 [QSA,NC,L]

这个10518271191304876236将作为查询参数ID传递给/latest_news/内的index.php文件。