由于某种原因,我得到了一个虚荣URL错误,并且没有其他帖子充分回答了这个问题。PHP代码有什么问题?
if (isset($_GET['username']) === true && empty($_GET['username']) === false) {
$username = $_GET['username'];
echo $username;
}
和我的.htaccess
文件是:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /lr/profile.php?username=$1
如果我去/projects/lr/profile.php?username=harrison7042
,它工作,但如果我去/projects/lr/harrison7042
,它不工作,只是返回:Object not found!
。
如果我改变这一行:
RewriteRule ^(.*)$ /lr/profile.php?username=$1
:
RewriteRule ^(.*)$ projects/lr/profile.php?username=$1
服务器返回Internal Server Error
。我不确定我做错了什么,或者什么。我完全遵循了这里的教程。
谢谢,哈里森
在。htaccess中更改:
RewriteRule ^(.*)$ /lr/profile.php?username=$1
RewriteRule ^(.*)$ profile.php?username=$1