CI 3.1.3隱藏index.php

來源:互聯網
上載者:User

標籤:php ci

環境為

windows10

php 5.6

apache2.4

  1. 在http.conf中開啟LoadModule rewrite_module modules/mod_rewrite.so

      將前面的#去掉

    

<Directory "D:/">

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn‘t give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

    # for more information.

    #

    Options Indexes FollowSymLinks


    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   Options FileInfo AuthConfig Limit

    #

    AllowOverride All


    #

    # Controls who can get stuff from this server.

    #

    Require all granted

</Directory>

AllowOverride None將其改為AllowOverride All

   2.進入到CI根目錄,建立.htaccess檔案,輸入

     RewriteEngine on 

     RewriteCond $1 !^(index\.php|style|robots\.txt) 

     RewriteRule ^(.*)$ /index.php/$1 [L]

     當然如果你的目錄不是根目錄,則要注意,比如我的URL為

     http://myweb.com/citest/

    ,則最後一行 要改為         

     RewriteRule ^(.*)$ /ci/index.php/$1 [L]

   3. 將CI中設定檔(application/config/config.php)中

    $config[‘index_page‘] = "index.php";

     改成

    $config[‘index_page‘] = "";

    4.重啟apache

本文出自 “IT技術” 部落格,請務必保留此出處http://linuxubuntu.blog.51cto.com/4964714/1897320

CI 3.1.3隱藏index.php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.