Php 我的htaccess在000webhost中不工作
这是我在000webhost上与Codeigniter一起使用的.htaccess文件,它工作得非常好 我现在已经更新了每个文件,但是相同的.htaccess不起作用 我现在得到“500内部服务器错误”。 有什么问题吗 我的URL是。使用此Php 我的htaccess在000webhost中不工作,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,这是我在000webhost上与Codeigniter一起使用的.htaccess文件,它工作得非常好 我现在已经更新了每个文件,但是相同的.htaccess不起作用 我现在得到“500内部服务器错误”。 有什么问题吗 我的URL是。使用此 RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|assets|woff|eot|img|css|js|resources|robots\.txt) RewriteRule ^(.*
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|assets|woff|eot|img|css|js|resources|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
试试这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
htaccess文件应放在主目录中
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
试试这个代码
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]
尝试使用RewriteBase指令或在重写目标中使用绝对路径
$config['base_url'] = 'http://www.example.com/';
$config['index_page'] = '';
注意:000webhost服务器使用虚拟用户主目录,因此当您在重写目标中使用相对路径时,添加RewriteBase指令非常重要,否则您将得到404 not found
资料来源:
使用此选项更改您的htaccess代码
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L]
在解决此问题时,某些安装需要不同的方法。它可以是PHP版本、apache版本或其他版本。在某些php安装中,有必要在index.php之后的.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]
或
找到它。尝试删除你的
.htaccess
,然后尝试访问你的应用程序。你在htaccess中还有其他规则吗?删除htaccess会出现404错误。没有其他规则。.您使用的是什么版本的codeigniter?检查:确保您使用的CI3检查文件名和类名的首字母大写。@Nabin何时获得404?也不起作用。。我现在很困惑是否是它的htaccess文件抛出了这个错误。这个问题还会发生什么?
# 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