How to set up URL Rewrite

WBOY
Release: 2016-07-29 08:36:04
Original
1734 people have browsed it

URL Rewrite requires server support! Before enabling this setting, please make sure that the correct settings have been made on the server. For the setting method, please refer to the "Setting Method under Apache" and "Setting Method under IIS" below!
Setting method under Apache

Copy the code The code is as follows:


Open the Apache configuration file httpd.conf.
Remove the # in front of #LoadModule rewrite_module modules/mod_rewrite
Add in httpd.conf:

RewriteEngine On
#RewriteCond %{ENV:SCRIPT_URL} (?:index|dispbbs)[ -0 -9]+.html
RewriteRule ^(.*?(?:index|dispbbs))-([-0-9]+).html$ $1.php?__is_apache_rewrite=1&__rewrite_arg=$2

To realize the mapping of asp post URL to php post, add between and in the third step:
RewriteMap tolowercase int:tolower
RewriteCond %{QUERY_STRING} (?:boardid| page|id|replyid|star|skin)=d+ [NC]
RewriteRule ^(.*(?:index|dispbbs)).asp$ $1.php?${tolowercase:%{QUERY_STRING}}&__is_apache_rewrite=1
Save httpd.conf and restart Apache.


The above introduces the setting method of URL Rewrite, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template