RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index'.php|assets|woff|eot|img|css|js|resources|robots'.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
这是我在 000webhost 上与 Codeigniter 一起使用的 .htaccess 文件,它运行良好。
我现在已经更新了每个文件,但相同的 .htaccess 不起作用。
我现在收到"500 内部服务器错误"。可能有什么问题?
我的网址是 futsal-groove.net16.net/home。
某些安装需要不同的方法来解决此问题。它可以是PHP版本,apache版本或其他版本。在某些 php 安装中,有必要在索引后的 .htaccess 文件中添加问号.php 请尝试以下解决方案:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# If fuel is not a level up
# RewriteBase /public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# Notice the ? after index.php
或
RewriteRule ^(.*)$ index.php?$1 [L]
# Notice the fact that the slash has been removed after the ?
#Other possible setups:
RewriteRule ^(.*)$ /index.php/$1 [L]
# Notice the leading slash added before index.php
在这里找到它。
使用这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
CodeIgniter URLs .htaccess in codeigniter.com
试试这个
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
htaccess 文件应该放在主目录上
application
system
.htaccess
index.php
试试这个代码
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index'.php|images|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
在您的配置文件上
$config['base_url'] = 'http://www.example.com/';
$config['index_page'] = '';
用这个更改你的htaccess代码
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index'.php|images|js|uploads|css|robots'.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
尝试使用 RewriteBase 指令或在重写目标中使用绝对路径
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L]
注意:000webhost服务器使用虚拟用户主目录,因此在重写目标中使用相对路径时添加RewriteBase指令很重要,否则将找不到404。
源:
https://www.000webhost.com/faq.php?ID=16