To sum up the steps for hiding the index. php file on the first page

Source: Internet
Author: User
To sum up, hide the index. the steps of the PHP file are summarized to hide the index. step 1 of the PHP file. enable the mod_rewrite module & nbsp; remove LoadModulerewrite_module to hide the index. php file steps
To sum up the steps for hiding the index. php file
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 ',
),
),
...
),

Copy code
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

Copy code
In this way, you can 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.