【发布时间】:2015-12-19 11:28:45
【问题描述】:
所有这些步骤都有效??我尝试过但无法在我的 ubuntu 机器上工作
1.在 application/config.php 文件中进行以下更改
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
2.使用以下代码在根目录中制作 .htacces 文件
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
3.启用重写模式(如果您的重写模式未启用)
我。首先,使用以下命令启动它:
a2enmod 重写
二。编辑文件 /etc/apache2/sites-enabled/000-default
将 All AllowOverride None 更改为 AllowOverride All。
三。使用以下命令重新启动服务器:
sudo /etc/init.d/apache2 restart
【问题讨论】:
-
为什么人们从不在基本网址中放置斜杠?
标签: apache .htaccess codeigniter ubuntu mod-rewrite