UbuntuApache pseudo-static configuration url rewriting

Source: Internet
Author: User
Ubuntu Apache pseudo-static configuration url rewriting steps: 1. load the rewrite module sudoln-s/etc/apache2/mod-available/rewrite. load/etc/apache2/mod-enabled/rewrite. load2. change AllowOverrideNone in & lt; Directory & gt; & lt;/Directory & gt; of your host

To rewrite the url of Ubuntu Apache pseudo-static configuration, follow these steps:
1. Load the rewrite Module
Sudo ln-s/etc/apache2/mod-available/rewrite. load/etc/apache2/mod-enabled/rewrite. load

2. Change AllowOverride None in to AllowOverride All

3. Create a. htaccess file under the directory of your website
Create the following content:
RewriteEngine on
RewriteBase/
RewriteRule ^ (. *) show-([0-9] +)-([0-9] +) \. html $1/show. php? Itemid = $2 & page = $3

In this example, the rewriteruleis intended to input show-1-2.html in the browser, but the actual access is show. php? Itemid = 1 & page = 2


4. Restart apache2

5. Test

Input in show. php

Echo $ _ GET ['itemid']. $ _ GET ['page'];
?>
You will see
Get Results

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.