$
Regular expression. And $1 is 2, $2 is 3,
So it is replaced by forumdisplay. php? Fid = 2 page = 3 add the file directory specified by the previous RewriteBase, then take it to the forumdisplay. php? Fid = 2 page = 3.
2. Examples of common. htaccess applications (some examples refer to the four examples to illustrate the rewrite rules for. htaccess files)
4.
First join the user through linuxidc.com/forum-2-3.html access to the Discuz forum, then first through the. htaccess filter to see if it is needed. htaccess Guide the user if the list of Rewritecond Condition then rewrite it, Discuz is not listed Rewritecond so it should all be rewritten. So we started the transliteration, Forum-2-3.html this exactly matches the list of ^forum-([0-9]+)-([0-9]+) \.html$ The regular expression. and $2, $3, So substituting the following, that is, forumdisplay
met. This is the original and basic function of RewriteCond, for ease of understanding, let's take a look at several examples.
Example 1
RewriteEngine onRewriteCond %{HTTP_USER_AGENT} ^Mozilla/5.0.*RewriteRule index.php index.m.phpRewriteCond %{HTTP_USER_AGENT} ^Lynx.*RewriteRule index.php index.L.phpRewriteRule index.php
and so on, indicating ignoring caseRewritecond, like the IF statement in our program, means that if one or a few conditions are met, the Rewriterule statement immediately below the Rewritecond is executed, which is Rewritecond's most primitive and basic function, for convenience of understanding, Let's look at a few examples below.Rewriteengine onRewritecond%{http_user_agent} ^mozilla/5.0.*
1. Add www tags to subdomainsRewritecond%{http_host} ^ ([A-Z.] +)? example\.com$ [NC] Rewritecond%{http_host}!^www\. [NC] Rewriterule.? Http://www.%1example.com%{request_uri} [R=301,l]
This rule crawls the%1 variable of level two domain name, if not start with www, then add www, the former domain name and {Request_uri} will follow after.
2. Remove the WWW tag in the domain name Rewritecond%{http_host}!^example\.com$ [NC]
Rewirte basic function is to implement the URL of the jump and hide the real address, based on the Perl language of the canonical table specification. Usually help us achieve quasi-static, quasi-folder, domain name jump, prevent hotlinking and so on. This article explores technical details for mod_rewrite and URL matching, as well as rewritecond and rewriterule instruction formats.Rewirte Module Internal ProcessingThe internal processing of the Rewirt
http://www.3code.cn/rewriterule-htaccess%E8%AF%A6%E7%BB%86%E8%AF%AD%E6%B3%95%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B/First, regular expression tutorialThere is a classic tutorial: Regular expression 30-minute introductory tutorial, you can search for a bit.This tutorial is really simple, and after reading basically write some simple regular there is no problem. Regular is a long-term use of the tool, not to forget the time interval, so I read this tutoria
First, regular expression tutorialPseudo static rule notation rewriterule-htaccess detailed syntax use tutorial shareSimply put: pseudo-static is actually using PHP to parse the current address into another way to visit the site! To learn the writing of pseudo-static rules, you have to understand a little regular, it doesn't matter, just follow the set below.First, regular expression tutorialThere is a classic tutorial:Regular Expression 30-minute int
Because before the Web site feel inadequate specification, so re-adjust the URL, but did not think, Baidu submitted delete URL for a long time, now included or the previous URL, in order not to affect customer access, now want to put the old URL batch redirect to the new URL,
The old format is as follows: http://www.songhuala.com/p1099/Beijing gift/china_flowers_info.html
The new format is as follows: http://www.songhuala.com/-p-1099.html
I did the following redirects in. htaccess,
Rewriteen
Appache rewriterule Problems
I want to enter http://web/cms/user_detail/74/41245/in the Address bar.
Then redirect it to http://web/cms/user_detail.php?id=74contents_id=41245
But Rewriterule didn't work. 404 error
Not Found
The requested Url/cms/user_detail/74/41254/was not found on this server.
What is this for?
Httpd.conf the related configuration is as follows, what is missing the configuration?
---
How can I write this RewriteRule? Cainiao is in urgent need. how can I help t. php? Twww.baidu.com is rewritten to www.baidu.com for help. I hope you can help me for the first time. ------ solution ------------------ RewriteEngineOnRewriteBaseRewriteRule ^ t. php? T (. * How to write this RewriteRule? Cainiao is eager to use it. please help me.
How to Set/t. php? T = www.baidu.com is rewritten to/www.baidu
Today, I have been wondering what the scope of Apache rewriterule pattern is. From the Apache rewrite configuration of my company, I think it works on Uri. But I see the http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_rewrite.html (APACHE Chinese Reference Manual), which is written as follows:
PatternIs a Perl-Compatible Regular Expression acting on the current URL. "Current URL" refers to the value of the URL when the rule takes effect. It may be
The configuration process is as follows:
Apache enables the following modules:
Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_http_module modules/mod_proxy_http.soLoadmodule rewrite_module modules/mod_rewrite.so
Add the following statements to the configuration file:
Order deny, allowAllow from all
Find
Options followsymlinksAllowOverride noneOrder deny, allowDeny from all
Change none to all
Find
......
AllowOverride none
......
Change none to all.
Enable PHP:
Loadmo
Apache URL rewrite rewriterule parameters in detailWe often do some rewriting of some URLs over Apache, so there are a lot of options for rewriting strategies, such as how to redirect, how to handle parameters, the order in which rules are matched.For example, one of our apps will have the following URL rewrite rule: The following is the URL that needs to be redirected to http://page.test.com/channel/imall/index.html for domain imall.test.com access,S
The website address changed. for help, the RewriteRule regular expression was changed because the previous website address was not properly configured. However, I did not expect that Baidu submitted and deleted the website for a long time. now it is still the previous website address, in order not to affect customer access, we want to batch redirect old URLs to new URLs. the old format is as follows: http://www.songhuala.com/p1099/ /c.
Because the pre
Today in the use of. htaccess do pseudo-static time, there is a strange thing, there will be a problem with C + + in the URL, in the processing of C + + when the word, in any case, $_get will not get + +, can only get C space.At first I thought it was useless urlencode processing, and then found that the actual processing, backstage after the investigation, to determine the problem is rewrite, because in a single file environment can get C + + the word, of course, is through the urlencode.Reason
, then first through the. htaccess filter to see if it is needed. htaccess Guide the user if the list of Rewritecond Condition then rewrite it,Discuz is not listed Rewritecond so it should all be rewritten.So we started the transliteration, Forum-2-3.html this exactly matches the list of^forum-([0-9]+)-([0-9]+) \.html$The regular expression. and $2, $3,So substituting the following, that is, forumdisplay.php?fid=2page=3 plus the previous rewritebase specified file directory, then take him to th
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.