【发布时间】:2013-10-02 19:45:08
【问题描述】:
是否有任何简单/更快的方法来更改网址,例如
http://example.com/profile.php?id=52
到
http://example.com/profile/52/username
如果我有来自数据库的$row['id'] 和$row['username']?
我试过了,
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^profile/(.*)$ /profile.php?id=$1 [QSA,L]
但是,number/username 部分似乎很混乱。
【问题讨论】:
标签: php apache url-rewriting