0

私はphpとmysqlを使用して、getメソッドを使用してこの(http://localhost/Unnamed%20Site%202/resources/username)ようなURLからユーザー名を取得するプロファイルページを作成しているので、.htaccessを使用しましたが、.htaccessを配置したルートフォルダーが消えてしまい、ブラウザからのエラー メッセージ: 内部サーバー エラー サーバーで内部エラーまたは構成ミスが発生したため、要求を完了できませんでした。サーバー管理者の admin@localhost に連絡して、エラーが発生した時刻と、エラーの原因となった可能性のある操作を知らせてください。このエラーの詳細については、サーバー エラー ログを参照してください。 誰でも私を助けることができます??

これは apache_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

これは 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]
4

1 に答える 1

0

このエラーメッセージ

[Mon Mar 18 19:13:52 2013] [alert] [client 127.0.0.1] C:/wamp/www/Unnamed Site 2/resources/.htaccess: Invalid command 'RewriteEngine' , おそらくスペルが間違っているか、モジュールで定義されていないサーバー構成に含まれるリファラー:http://localhost/Unnamed%20Site%202/resources/account-setting.php

欠落しているmod_rewriteモジュールを示唆しています。使用する前に、まずインストールおよび/または構成する必要があります。

于 2013-03-18T21:37:51.830 に答える