CodeIgniter htaccess和URL重写问题

CodeIgniter htaccess和URL重写问题,第1张

CodeIgniter htaccess和URL重写问题

有3个步骤要删除

index.php

  1. application/config.php
    文件中进行以下更改

    $config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';

    $config[‘index_page’] = ‘’;
    $config[‘uri_protocol’] = ‘AUTO’;

  2. .htaccess
    使用下面的代码文件的根目录

    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 rewrite

ii。 编辑档案

/etc/apache2/sites-enabled/000-default

全部更改

AllowOverride None
AllowOverride All

注意:在最新版本中,您需要更改

/etc/apache2/apache2.conf
文件

iii。 使用以下命令重新启动服务器:

    sudo /etc/init.d/apache2 restart


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5045637.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存