URL static solution using the. htaccess file

Source: Internet
Author: User
Using the. htaccess file to achieve URL static using the. htaccess file to achieve URL static problems are described as follows: I want to implement the following functions: non-static URL: inetassistant. comtasks. php? Id28 & amp; titleWordpress static URL: inetassistant. comtasks28Word static URL using the. htaccess file
Static URL using the. htaccess file
The problem is described as follows:
I want to implement the following functions:
Non-static URL: http://inetassistant.com/tasks.php? Id = 28 & title = Wordpress
URL after static implementation: http://inetassistant.com/tasks/28/Wordpress.html
1.
Put the. htaccess file under the root directory of the website. The content is as follows:

Options-Indexes
RewriteEngine On
RewriteBase/
RewriteRule ^/tasks/([0-9] +)/([a-za-z?##.html $/tasks. php? Id = $1 & title = $2

The link in the PHP file is written as follows:
Wordpress

However, enter
Http://www.xxx.com/tasks/28/wordpress.htmlcannot access

Http://www.xxx.com/tasks.php/28/wordpress.html#can access (but cannot display the corresponding content)

2. the other situation is:
RewriteRule ^/tasks. php/([0-9] +)/([a-za-z?##.html $/tasks. php? Id = $1 & title = $2

Write Wordpress like this

When I click a link, I cannot configure http://www.xxx.com/tasks.php/28/wordpress.html, but there is no corresponding content,
Note: Wordpress is actually dynamically retrieved from the database for the purpose of looping the output title and clicking the title to display the corresponding article content.
Please help me to find out where these two problems occur

------ Solution --------------------
RewriteEngine On
RewriteBase/
RewriteCond % {REQUEST_URI} ^/tasks/([0-9] +)/([A-Za-z] +) \. html $
RewriteRule ^. + $ tasks1.php? Id = % 1 & title = % 2 [L]

What configuration is added to my apache environment?
When tasks and my file names are the same, they won't match. I just need to replace tasks. php with task1.php.

Put this in the folder where task1.php is located.

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.