无法使用 htaccess 重定向到个人资料页面

Cannot redirect to profile page with htaccess

这是我正在使用的 htaccess 代码

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$profile.php?q= [L,QSA]

当用户访问他的个人资料时,url 应该从 http://domain.com/profile.php to http://domain.com/username(登录用户的用户名)

更改

它给出的错误是当我键入 http://domain.com/lina 它说找不到页面

您的 RewriteRule 中缺少一个 space:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ profile.php?q= [L,QSA]