Yii Optimized routing Apache configuration (removal of index.php on Apache server access mode)

Source: Internet
Author: User
Tags yii

Remove index.php on the Apache server access mode

Below I say Apache, how to remove the URL inside the index.php
For example: Your original path is: Localhost/index.php/index
The changed path is: Localhost/index

The mod_rewrite.so module is loaded in the 1.httpd.conf configuration file//configured in Apache
#LoadModule rewrite_module modules/mod_rewrite.so To remove the siren from the front.

2.httpd.conf config file, change the allowoverride none inside to allowoverride all

Note: Be sure to restart the Apache service after you modify it.

2. Add the. htaccess file to the index.php sibling directory (entry file)

Options+followsymlinksIndexignore*/*  rewriteengine    on    # if a directory or a File exists, use it directly    Rewritecond   %{request_filename}!-f  < Span style= "COLOR: #8959a8" >  rewritecond   %{request_filename} !-d    # Otherwise forward it to index.php    Rewriterule   . index.php      

3. Go to config file web.php

Untie the notes from the following paragraph.

        /*        ' urlmanager ' + [' enableprettyurl ' = ' = '            ,            ' showscriptname ' = False,            ' rules ' = [            ],        ],        */

Yii Optimized routing Apache configuration (removal of index.php on Apache server access mode)

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.