簡體   English   中英

500 內部服務器錯誤代碼Igniter htaccess mod_rewrite

[英]500 Internal Server Error CodeIgniter htaccess mod_rewrite

我在 Windows 上編寫了我的 Web 應用程序,然后將其推送到運行 Ubuntu Linux 的服務器。 這是我的 .htaccess 文件:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /SearchDatGifUbuntu/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
  # If we don't have mod_rewrite installed, all 404's
  # can be sent to index.php, and everything works as normal.
  ErrorDocument 404 /index.php
</IfModule>

我在 /etc/apache2/sites-available/default 的文件如下:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

我在 ubuntu 服務器的命令行中輸入了 sudo a2enmod rewrite ,它說 mod_rewrite 已經打開。

當我調試我的 codeigniter 應用程序時,錯誤似乎出現在 CodeIgniter.php 的第 308 行,即:

$CI = new $class();

有人可以讓我知道發生了什么嗎?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]  

試試這個 .htaccess 代碼,然后重啟你的 apache

如果這不起作用,請嘗試此鏈接

如何為 Apache 2.2 啟用 mod_rewrite

我不得不編輯:

/etc/apache2/apache2.conf

並設置:

<Directory /var/www/html>
    # ... other directives...
    AllowOverride All
 </Directory>

然后重啟apache,以便讀取上面的.htaccess代碼。

在 CI 項目文件夾中創建一個 .htaccess 文件。 在文件中輸入以下代碼。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM