i am using the php and mysql to create a profile page using the get methode to get the username from the url like this (http://localhost/Unnamed%20Site%202/resources/username)
so i used the .htaccess but the problem was that the root folder where i put the .htaccess was disappear and i get an error msg from the browser : Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. anyone can help me??
我正在使用php和mysql创建一个配置文件页面使用get方法从这个URL获取用户名(http:// localhost / Unnamed%20Site%202 / resources / username)所以我使用了.htaccess但是问题是,我把.htaccess的根文件夹消失了,我从浏览器收到错误消息:内部服务器错误服务器遇到内部错误或配置错误,无法完成您的请求。请与服务器管理员admin @ localhost联系,告知他们错误发生的时间,以及可能导致错误的任何操作。服务器错误日志中可能提供了有关此错误的更多信息。谁都可以帮帮我?
this is the appache_error.log
[Mon Mar 18 19:13:05 2013] [error] [client 127.0.0.1] PHP 1. {main}() C:\\wamp\\www\\Unnamed Site 2\\resources\\profile.php:0, referer: http://localhost/Unnamed%20Site%202/resources/
[Mon Mar 18 19:13:16 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:13:21 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/Unnamed%20Site%202/resources/account-setting.php
[Mon Mar 18 19:13:52 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:09 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/Unnamed%20Site%202/resources/profile.php
[Mon Mar 18 19:23:09 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:09 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:11 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:11 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:12 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:13 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:14 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Mon Mar 18 19:23:16 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: http://localhost/Unnamed%20Site%202/
[Mon Mar 18 19:23:16 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
and this is the profile.php
// updatede for using the GET methode for ge the data nedded from the url
if(isset($_GET['u']))
{
$username = mysql_real_escape_string($_GET['u']);
if(ctype_alnum($username))
{
//check user exist
$check = mysql_query("SELECT user_name, first_name FROM user WHERE user_name = '$username' ")or die(mysql_error());
if (mysql_num_rows($check)==1)
{
$get = mysql_fetch_assoc($check);
$username = $get['user_name'];
$fname = $get['first_name'];
}
else
{
// this line is to redirect the unexist users to the index.php
echo "<meta http-equiv=\"refresh\" content=\"0; url=http://localhost/Unnamed Site 2/resources/index.php\">";
exit();
}
}
}
?>
.htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?u=$1 [L]
1 个解决方案
#1
0
This error message
此错误消息
[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer:
http://localhost/Unnamed%20Site%202/resources/account-setting.php
[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/ wamp / www / Unnamed Site 2 / resources / .htaccess:无效的命令'RewriteEngine',可能拼写错误或由模块定义包含在服务器配置中,referer:http://localhost/Unnamed%20Site%202/resources/account-setting.php
hints at a missing mod_rewrite
module. You must first install and/or configure it, before you can use it.
提示缺少mod_rewrite模块。您必须先安装和/或配置它,然后才能使用它。
#1
0
This error message
此错误消息
[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration, referer:
http://localhost/Unnamed%20Site%202/resources/account-setting.php
[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/ wamp / www / Unnamed Site 2 / resources / .htaccess:无效的命令'RewriteEngine',可能拼写错误或由模块定义包含在服务器配置中,referer:http://localhost/Unnamed%20Site%202/resources/account-setting.php
hints at a missing mod_rewrite
module. You must first install and/or configure it, before you can use it.
提示缺少mod_rewrite模块。您必须先安装和/或配置它,然后才能使用它。