【问题标题】:page not found after index.php removed删除 index.php 后找不到页面
【发布时间】:2017-02-03 09:21:27
【问题描述】:

我想从我的网站上删除 index.php。我尝试了这些步骤,但仍然无法正常工作:

  • $config[index_page] = '';
  • 在系统文件夹的 .htaccess 中添加了这个: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase/seotutor/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
  • 在 wamp apache 中启用 mod_rewrite
  • 覆盖 httd.conf 中的所有内容

【问题讨论】:

    标签: php jquery google-chrome jquery-plugins codeigniter-3


    【解决方案1】:

    试试这个:

    步骤:-1 打开文件夹“application/config”并打开文件“config.php”。在 config.php 文件中查找并替换以下代码。

    //find the below code   
    $config['index_page'] = "index.php" 
    //replace with the below code
    $config['index_page'] = ""
    

    步骤:-2 转到您的 CodeIgniter 文件夹并创建 .htaccess

    Path:
    Your_website_folder/
    application/
    assets/
    system/
    .htaccess <——— this file
    index.php
    

    步骤:-3 在 .htaccess 文件中写入以下代码

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L] 
    </IfModule>
    

    步骤:-4 在某些情况下,uri_protocol 的默认设置不能正常工作。要解决这个问题,只需打开文件“application/config/config.php”,然后找到并替换以下代码

    //find the below code
    $config['uri_protocol'] = "AUTO"
    //replace with the below code
    $config['uri_protocol'] = "REQUEST_URI" 
    

    这会对你有所帮助。

    【讨论】:

    • 嗨,我尝试了这些步骤,但仍然无法正常工作,注册 将转到正确的页面。
    猜你喜欢
    • 2019-08-24
    • 2023-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-20
    • 2014-09-27
    • 1970-01-01
    • 2019-05-24
    相关资源
    最近更新 更多