Using. htaccess files to implement URL static resolution
Source: Internet
Author: User
Using. htaccess files to implement URL statics
Using. htaccess files to implement URL statics
The problem is described as follows:
I now want to implement the following functions:
Non-static url:http://inetassistant.com/tasks.php?id=28&title=wordpress
Implementation of url:http://inetassistant.com/tasks/28/wordpress.html after static
1.
The. htaccess file I placed below the root directory of the Web site, the following content:
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 like this:
Wordpress
But in the browser input
Http://www.XXX.com/tasks/28/Wordpress.html Cannot access
Http://www.XXX.com/tasks.php/28/Wordpress.html is able to access (but not to display the corresponding content)
2. In addition, the following situations are:
Rewriterule ^/tasks.php/([0-9]+)/([a-za-z]+). html$/tasks.php?id=$1&title=$2 Write like this
Wordpress writes like this
I can not access the http://www.XXX.com/tasks.php/28/Wordpress.html when I click on the link, but there is no corresponding content,
It is added that: like 28,wordpress is actually obtained from the database dynamically, the purpose is to loop the output title, and then click on the title to display the corresponding article content
Ask a master to help answer the question of where the two situations appear
My Apache environment estimated what configuration was added
When the tasks and my file name are the same, the match is not, I will change the tasks.php to task1.php on the line.
This will be placed in the folder where the task1.php is located.
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.