Yii Hidden Portal File index.php

Source: Internet
Author: User
Tags yii

1. Open Apache Mod_rewrite module

#去掉LoadModule Rewrite_module modules/mod_rewrite.so before the "#" symbol # if it is an Ubuntu system, the default is to turn on rewrite cd/etc/apache2/ mods-enabled# See if there is a rewrite.load link file, and if not, establish a linked file Cd/etc/apache2/mods-enabledln-s: /mods-available/rewrite.load rewrite.load//This step is not verified

2, ensure <directory "..." ></Directory> "allowoverride All"

Here's an example, other things like:

#现有一个工程project, you need to configure the virtual host document cd /etc/apache2/sites-availablesudo vi project# to put the following contents <virtualhost  *:80>       ServerAdmin [email protected]        ServerName baike.petshome.cn        documentroot /var/www/project       <directory />                Options  followsymlinks                allowoverride all       </directory>        <Directory /var/www/project>                Options FollowSymLinks MultiViews                allowoverride all                Order allow,deny                allow from all       </Directory>        ErrorLog ${APACHE_LOG_DIR}/error.log        # possible values include: debug, info, notice, warn,  error, crit,       # alert, emerg.        loglevel warn       customlog ${apache_ Log_dir}/access.log combined</virtualhost> #然后确保AllowOverride  all can be

3. Modify the project configuration file to modify the code in the/protected/config/main.php in the project

‘components‘=>array(

  ...

  ‘urlManager‘=>array(

    ‘urlFormat‘=>‘path‘,

    ‘showScriptName‘=>false,//注意false不要用引号括上

    ...

),

4. Add the file ". htaccess" in the same directory as the index.php file.

Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

# if a directory or a file exists, use it directly

rewritecond Span style= "Color:rgb (147,161,161); class=" pun ">%{ request _filename } !-

RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php

RewriteRule . index.php

This will hide the index.php entry file.

Reference: http://www.yiiframework.com/forum/index.php/topic/1061-%e9%9a%90%e8%97%8findexphp%e7%9a%84%e6%ad%a5%e9%aa%a4/

This article is from the "Lost Moon" blog, please be sure to keep this source http://luecsc.blog.51cto.com/2219432/1436656

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.