" function. Let's talk about it later ). Therefore, ASP. net mvc usually does not require ASP. NET-level URL Rewrite. Nowadays, the IIS-level URL Rewrite can be avoided because of some special problems.
The URLs involved in the following take http://51programming.com as an example
. Therefore, for the above URLs, Request. pathInfo returns "/Books", "/DVDs", and "/CDs" respectively (in case you want to know, the Request Path attribute returns "/products. aspx ").Then, you can easily write a function to obtain the product category, as shown in this case (the following function removes the previous slash character and returns only "Books", "DVDs ", or "CDs "):Function GetCategory () As StringIf (Request. PathInfo. Length = 0) ThenReturn ""ElseReturn Request. PathInfo. Substr
.
The Uninitialized_variable_warn directive (HTTP, server, location, and if context) is used to turn on or off logging of warning logs in uninitialized variables.
The value is on or off.
Configure URL RewritingThe configuration of URL rewriting in Nginx is as follows:location ^~ / { root html; index index.html index.htm; rewrite ^/b
implement URL rewriting
The above request. pathinfo technology is replaced by the httpcontext. rewritepath method provided by ASP. NET. This method allows developers to dynamically rewrite the processing path of the received URL, and then allow ASP. NET to continue executing the request using the previously rewritten path.
For
> Rewriterconfig > A regular expression is a very bad thing. It can be matched and captured. In the preceding example, we locate/Tag/xxx that meets the lookfor condition to tags. on the ASPX page, XXX is used as the value of the tag querystring item.CodeHttpcontext. Request. querystring ["tag"] to obtain the value. The urlrewriter feature is sufficient for most applications, but I always don't like it. But if I have to ask why I don't like it,
characters, () The function of parentheses is to make a mark for all characters so that they can be used later. refers to the (. *) character in front. example two: Jump to http:www.domain.cn when entering a example.com domain name Rewriteengine onRewritecond%{http_host} ^example.com [NC]Rewriterule ^ (. *) http://www.domain.cn/ [L] http://ss.kiya.cn/bbs/tread-60.html , let it continue in effect under the new domain name, click Forward to , while
I recently wrote a small example, you can see this first, there are small examples of the complete code download
Http://www.jb51.net/article/20906.htm
For a long time did not write technical articles, if you do not understand, see more than a few, Khan, or, in the back of the article (this is the most effective way), I will try to help everyone to answer questions.
To find this article, should know what is called the level two domain name, nonsense w
What is URL rewrite )?URL rewriting is the process of redirecting incoming Web requests to other URLs.For example, when a browser sends a request http://www.test.com/tags/, the server automatically redirects the request to http://www.test.com/tags.asp
We know that there is mod_rewrite in Apache to implement the
%{request_filename}.php-fRewriterule ([^/]+) $/test/$1.php#for Example:/test/admin =/test/admin.phpRewriterule ([^/]+) \.html$/test/$1.php [L]#for Example:/test/admin.html =/test/admin.phpRestrict a catalog to display only picturesRewriteengine onRewritecond%{request_filename}!^.*\. (gif|jpg|jpeg|png|swf) $Rewriterule. *$–[f,l]Update June 10, 2009Supplemental, overrides for a specific file extension.Rewrite
follows:
8 T=mime-type (Force MIME type) force MIME type
9 NS (used only if no internal sub-request) is used only for not internal child requests
NC (no case) is case-insensitive
QSA (query string append) Append request string
NE (no URI escaping of output) not escaping special characters in output
For example: rewriterule/foo/(. *)/bar?arg=p1%3d$1 [R,ne] will be able to correctly convert/foo/zoo to/bar?arg=p1=zoo
PT (pass throug
don't want to write the second-level domain name to Web. config, and the target url I want to rewrite cannot be written to. For example, we have such a need.The actual processing page of love.yourdomain.com is yourdomain.com/action.aspx? Id = 1The actual processing page of call.kerryl.com is yourdomain.com/action.aspx? Id = 2The actual processing page of walkwit
The equals type (=) has the highest precedence. Once the match succeeds, no other matches are found.
An ^~ type expression. Once the match succeeds, no other matches are found.
The priority of the regular expression type (~ ~*). If more than one location has a regular match, the longest regular expression will be used.
The regular string match type. Match by prefix.
Example-Fake address mask true addressserver { # 用 xxoo_
(. *) character.
Example 2: Jump to www.jb51.net when you enter the domain name of en.jb51.netCopy codeThe Code is as follows: RewriteEngine onRewriteCond % {HTTP_HOST} ^ en.jb51.net [NC]RewriteRule ^ (. *) http://www.jb51.net/[L]
Example 3. Recently, the SAICA software has changed its domain name. The new domain name is www.jb51.net. In this case, the original domain name ss.jb51.net, as well as the addre
URL rewriting this thing has been used many times in the work, but every time forget to remember to accumulate the knowledge.Hey, either think not necessary, or just don't have the time?!One, Apache articleOfficial address: http://man.chinaunix.net/newsoft/ApacheManual/mod/mod_rewrite.html1.htaccess Basic Syntax IntroductionThe server has a configuration file can not be changed by us, so in most cases, in the root directory of the site to build a. hta
from the request.headers.
1 if the overriding component is isapi_rewrite, then when accessing the overridden URL, an additional data will be added to the headers: key is X-rewrite-url and the value is the URL before the rewrite.
2 If the overriding component is a
thinkphp pathinfo access mode, path access mode and URL rewrite summary, thinkphppathinfo
This paper summarizes the two modes of pathinfo in thinkphp, four kinds of path access modes and URL rewriting, and shares them for easy reference. The specific summary is as follows:
1, PathInfo
Access the test method below the module IndexAction.class.php
Http://localhost
http://lesca.me/archives/htaccess-rewrite.html/comment-page-1#comment-16045
Catalog Table of Contents First, ready to start: Mod_rewrite. htaccess implements URL rewriting (rewrite) and URL redirection (redirect) to map an. htm page to a. PHP Temporary redirect ( r=302) and permanent redirection (r=301) Why use redirection. --the difference between redirection a
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.