Configuration. htaccess Single Point entry _php tutorial

Source: Internet
Author: User
First enable the Mod_rewrite module (varies by operating system, current Linux)
1,apache Enabling the Mod_rewrite module

Editor:/etc/apache2/httpd.conf
Uncomment: LoadModule rewrite_module/usr/lib/apache2/modules/mod_rewrite.so

2, select Directory to change allowoverride None to allowoverride all.

3, restart Apache

The project root creates a file. htaccess the request to the public directory (adjusted on demand)
1
2 Rewriteengine on
3 Rewriterule ^$ public/[L]
4 Rewriterule (. *) public/$1 [L]
5

Finally, turn the request to the public/index.php file (where all requests are distributed)

1
2 Rewriteengine on
3
4 Rewritecond%{request_filename}!-f
5 Rewritecond%{request_filename}!-d
6
7 Rewriterule ^ (. *) $ index.php?url=$1 [pt,l]
8
9

app->public->index.php
This can achieve a single portal of the site, but also the beginning of the MVC pattern, the next step you can try to distribute our URL for the three part of controller/action/querystring ....


Excerpted from Warcraft

http://www.bkjia.com/PHPjc/478226.html www.bkjia.com true http://www.bkjia.com/PHPjc/478226.html techarticle first enable the Mod_rewrite module (adjusted by operating system, current Linux) 1,apache enable mod_rewrite module editing:/etc/apache2/httpd.conf uncomment: LoadModule Rewrit ...

  • 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.