我坚持这个问题,因为几个小时,如果有人可以帮助我它真的很棒,所有都在标题codeigniter只加载我的索引页甚至认为网址正在改变和我的函数调用。我激活了mod_rewrite并设置了我的配置变量($ config [' index_page'] ='';和base_url())如果有人有想法!在这里,我告诉你我的.htaccess
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ EHA/index.php/$1 [L,QSA]
答案 0 :(得分:0)
试试这个:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
希望它有所帮助。
答案 1 :(得分:0)
打开config.php并执行以下替换
$config['index_page'] = "index.php"
到
$config['index_page'] = ""
只需替换
$config['uri_protocol'] ="AUTO"
到
$config['uri_protocol'] = "REQUEST_URI"
并替换
$config['base_url'] = 'localhost:8888/EHA/';
到
$config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])) . '/';
$config['base_path'] = $_SERVER['DOCUMENT_ROOT'] . preg_replace('@/+$@', '', dirname($_SERVER['SCRIPT_NAME'])) . '/';
AND IN HTACCESS FILE下面的代码
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
答案 2 :(得分:0)
你可以试试这个: 如果 .htaccess 文件未添加。 添加 .htaccess 文件。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#RewriteRule ^muser/([0-9]+) muser/index/$1
</IfModule>
config.php 并执行以下操作
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;