Steps of Yii hidden index.php file

Source: Internet
Author: User
Tags yii
How to: Yii Hide index.php files
Author: zccst

1. Modify the Apache configuration httpd.conf
(1) Open Apache Mod_rewrite module to remove the "#" symbol before LoadModule rewrite_module modules/mod_rewrite.so
(2) ensure There are "allowoverride all" in the
Annotations: For Wamp, the second allowoverride all is turned on.
allowoverride in Apache configuration file three times, but only one place needs all, the other two places are none.
(3) Restart Apache

2. Add the code in the/protected/config/main.php in the project:
    ' Components ' =>array (...                ')                Urlmanager ' =>array (                      ' urlformat ' = ' path ',                      ' showscriptname ' =>false,//note false do not enclose in quotation marks                      ' Urlsuffix ' + '. html ',//ride plus. html suffix, overbearing                      ' rules ' =>array (                          ' sites ' = ' site/index ',                      )                ,                ...            ),


3. Under the same sibling directory as the index.php file AddFile ". htaccess", which reads as follows:
       Options +followsymlinks        indexignore */*        rewriteengine on        # If a directory or a file exists, use it directly        Rewritecond%{request_filename}!-f        Rewritecond%{request_filename}!-d        # Otherwise forward it to index.php        Rewriterule. index.php

Annotations: This section is also available in Yii's official guide:
See: Http://www.yiiframework.com/doc/guide/1.1/zh_cn/topics.url

This makes it possible to hide the index.php entry file.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.