Three kinds of Apache Rewrite URL configuration methods

Source: Internet
Author: User
Tags php tutorial web hosting mediawiki

Three kinds of Apache Rewrite URL configuration methods

Scenario 1: Simplest, do not configure Apache
Uri Effect: PHP tutorial/subject/4843637/">http://movie.example.com/index.php/subject/4843637/

Case: MediaWiki

Todo

Scenario 2: Configure Apache URL rewrite, redirect to index.php, with parameters
Uri Effect: http://movie.example.com/subject/4843637/

Case: MediaWiki

Todo

Scenario 3: Configure Apache URL rewrite, redirect to index.php, no parameters
Uri Effect: http://movie.example.com/subject/4843637/

Todo

Data: Two ways to configure Apache URL rewrite
1. htaccess file (do not restart Apache)
Scope of application: Virtual host, such as unable to restart Apache situation

Step: Open the allowoverride all in Apache Conf (the virtual host is generally open),

Write the Rewriterule to the. htaccess file and place it in the Web Access directory.

2, Apache Conf (restart Apache)
Scope of application: VPS, etc. can restart Apache situation

Step: Write Rewriterule to httpd.conf or httpd-vhosts.conf files

Ps:

Remember to come to school, in the virtual host (Web Hosting), can not restart Apache, want to configure rewrite, went to the library to turn a lot of books have not been found. Later on the internet to learn. htaccess, has not been recorded.

Later the project was always with Apache Conf. A few days ago my colleague asked me: "Not Configured Apache, why can use the slash/pass parameters, like index.php/id/123/."

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.