.htaccess在我的xampp服务器上运行正常但是当我将它上传到网络服务器时,它给了我这个错误" 404找不到页面找不到你请求的页面。"
这是我的配置。
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
我的.htaccess是
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
我将codeigniter放在子文件夹/ sibulanAdmin中 http://sibulanlgu.spillworks.net/sibulanAdmin/
这花了我很多时间在网上搜索,但没有解决方案适合我。 请帮忙
答案 0 :(得分:0)
根据您提供的信息,您的.htaccess应该是这样的。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /sibulanAdmin/index.php/$0 [PT,L]
确保在您的服务器上启用mod重写。如果还没有,您应该继续this回答和this教程。希望它对你有用。
修改强>
您可以通过键入以下内容来启用mod重写:
a2enmod rewrite
然后,不要忘记在apache配置中将AllowOverride
设置为all
文档根目录。在你的apache2.conf中,(在我的情况下是/etc/apache2/apache2.conf
)
<Directory /var/www/>
AllowOverride All
</Directory>
最后,只需要重新启动服务器。
service apache2 restart
答案 1 :(得分:0)
尝试下面的htaccess,它对我有用我有xampp并且可以在实时服务器上正常工作
并改变
$config['uri_protocol'] = 'REQUEST_URI';
要
$config['uri_protocol'] = 'AUTO';
<强> htaccess的强>
Options +FollowSymLinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>
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]