[英]500 Internal Server Error CodeIgniter htaccess mod_rewrite
I coded my web application on windows, and I am pushing it to my server, which runs Ubuntu Linux.我在 Windows 上编写了我的 Web 应用程序,然后将其推送到运行 Ubuntu Linux 的服务器。 Here is my .htaccess file:
这是我的 .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>
My file at /etc/apache2/sites-available/default is as follows:我在 /etc/apache2/sites-available/default 的文件如下:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I typed sudo a2enmod rewrite into the command line on my ubuntu server, and it says mod_rewrite is already turned on.我在 ubuntu 服务器的命令行中输入了 sudo a2enmod rewrite ,它说 mod_rewrite 已经打开。
As I debugged through my codeigniter application, the error seemed to show up on line 308 in CodeIgniter.php, which is:当我调试我的 codeigniter 应用程序时,错误似乎出现在 CodeIgniter.php 的第 308 行,即:
$CI = new $class();
Can someone please let me know what is going on?有人可以让我知道发生了什么吗?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Try this .htaccess code, and restart your apache试试这个 .htaccess 代码,然后重启你的 apache
If this does not work please try this link如果这不起作用,请尝试此链接
How to enable mod_rewrite for Apache 2.2 如何为 Apache 2.2 启用 mod_rewrite
I had to edit:我不得不编辑:
/etc/apache2/apache2.conf /etc/apache2/apache2.conf
and set:并设置:
<Directory /var/www/html>
# ... other directives...
AllowOverride All
</Directory>
And then restart apache, in order for the above .htaccess code to be read.然后重启apache,以便读取上面的.htaccess代码。
Create a .htaccess file in your CI project folder.在 CI 项目文件夹中创建一个 .htaccess 文件。 Enter the code below in the file.
在文件中输入以下代码。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.