Php 我的htaccess文件不断出现404错误
我不想在这些问题上纠结,我正在努力让这一点起作用 我一直都有404个错误,有人能帮我一下吗Php 我的htaccess文件不断出现404错误,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,我不想在这些问题上纠结,我正在努力让这一点起作用 我一直都有404个错误,有人能帮我一下吗 RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [QSA,L] 这就是我目前所拥有的。我正在使用CodeIgniter框
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
这就是我目前所拥有的。我正在使用CodeIgniter框架。请在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]
这一个在我的实例中运行良好…这一个在goDady上的我的站点上运行良好
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# This one is important for goDaddy
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
# or you can use like this also
RewriteRule ^(.*)$ index.php?url=$1 [L]
</IfModule>
在config.php中
$config['index_page'] = 'index.php';
$route['default_controller'] = "home"; // whatever default controller
在routes.php
$config['index_page'] = 'index.php';
$route['default_controller'] = "home"; // whatever default controller
有时GoDaddy需要很少的时间来获取update.htaccess,所以请为每次尝试留出一些时间。别忘了清除浏览器缓存。Firefox中的Ctrl+F5可以在没有缓存的情况下刷新。有一个聪明的答案,可以在您无权访问RewriteLog(我假设您无权访问)的服务器上调试htaccess中的重写规则。试试这段代码
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1
试试这个代码,它对我有用。我在我的windows pc以及UBUNTU和CentOS服务器上用XAMP和WAMP测试了它。我的codeigniter版本是(2.1.0)
将此文件用作ur.htaccess文件,并检查是否已启用mod rewrite
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
试试这个
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Apache中是否启用了mod_重写?你从哪里得到这个错误?在服务器上还是在本地机器上?我不确定您是否需要第三行。最后一行应该重新写入。试着评论第三行。我已经删除了第三行,但仍然没有joy和它的服务器端,我以前在我的主机上使用过框架,所以我猜它应该使用godaddy主机,它告诉我它已启用,而上面的仍然不起作用!就像我说的,我对此不是很了解!如果安装在文件夹中而不是根目录下,则必须将文件夹名称添加到“重写库”。例如:RewriteBase/foldername/我将文件名添加到了/中,但仍然没有乐趣!im莫名其妙如果您的网站位于文件夹中,则只有您需要添加文件夹名称。。否则请保持原样。@Morby Raybould您是否尝试过使用默认的codeIgniter应用程序文件夹?我是说什么都不改变。您是否从codeIgniter或apache收到404错误?
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
try this.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]