重写配置文件页的URL


Rewrite URL for Profile Page

如何使用.htaccess重写:

mysite.com/profile/[username]

转到:

mysite.com/profile.php?id=[username]

我不想重新加载页面,只需要更改URL使其看起来不错。

感谢您的帮助。

这是应该让您开始的htaccess规则:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule profile/(.+) profile.php?id=$1