Yii Series Summary: hide index. php steps

Source: Internet
Author: User
Yii Series Summary: hide index. php step 1. enable mod_rewrite module of apache ????? Remove the "#" symbol before LoadModulerewrite_modulemodules/mod_rewrite.so ????? Make sure & lt; Directory "..." & gt; & lt Yii Series Summary: hide index. php steps

1. enable the mod_rewrite module of apache
????? Remove the "#" symbol before LoadModule rewrite_module modules/mod_rewrite.so.
????? Ensure "AllowOverride All"
2. add the code to/protected/config/main. php in the project:

-----------------------------------------

'Components' => array (

???????????...

??????????? 'Urlmanager' => array (

????????????????? 'Urlformat' => 'path ',

????????????????? 'Showscriptname' => false, // note that false is not enclosed in quotation marks.

??????????? 'Urlsuffix '=> '.html ',

????????????????? 'Rules' => array (

????????????????????? 'Sites '=> 'site/Index ',

?????????????????),

???????????),

???????????...

???????),

------------------------------------------


3. add the file ". htaccess" in the same directory as the index. php file. the content is 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

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.