So it is very important to understand the rewrite rule of Apache, which can implement pseudo static of URL. Or do 301 jump.
Rewrite logo
R[=code] (Force redirect) force external redirectionForce the substitution string plusThe
The existing is Apache load balanced to 6 different tomcat above, today encountered the need to forward some specified URL to the specified 3 Tomcat requirements, must be modified rewrite rule rules, online search for a half-day, there is no good
1. Use rewrite to confirm that your Apache can use rewrite mod
Rewriteengine on
Rewritecond%{http_referer}!^http://linuxsky.net/.*$ [NC]
Rewritecond%{http_referer}!^http://linuxsky.net$ [NC]
Rewritecond%{http_referer}!^http://www.linuxsky.net/.*$
1. Nginx Rewrite rules related directives
Nginx rewrite rules related directives have if, rewrite, set, return, break, etc., where rewrite is the most critical instruction. A simple nginx rewrite rule syntax is as follows:
Rewrite ^/b/(. *) \.html/
What is a virtual host? That is to make your own local development of the machine into a virtual domain name, such as: you in the development of a project under the PPTV 127.0.0.1/pptv_trunk, you want to turn your own computer domain name into
1. htaccess File Use premise
The main role of htaccess is to implement URL rewriting, that is, when the browser access to a server folder through the URL, as the owner, we can receive the URL, how to receive it, is the role of this document. All
Demand:
Six-file entry, all others redirected to index
Own ideas:
The pattern of URLs that are not six files is identified and filtered.
Compare your colleagues ' results with your own thinking questions:
1. If you want to find out all the
1. Remove the WWW tag from the domain name
Copy Code code as follows:
Rewritecond%{http_host}!^jb51\.net$ [NC]
Rewriterule.? Http://jb51.net%{request_uri} [R=301,l]
2. Remove the WWW tag, but save the child domain name
For example: www.xxx.comxindex.htmlwww.xxx.comxindex.html? Why? B1y & amp; b2z & amp; ...... how to write rewrite... example:
Http://www.xxx.com/x/index.htmlHttp://www.xxx.com/x/index.html? B1 = y & b2 = z
Recently, the project needs to load the rewrite module dynamically in the compiled Apache. As a result, we found a lot of information on the Internet, but it was not very detailed and the format mismatch problem was serious. Therefore, it is
How to enable the Rewrite function of Apache in Ubuntu. After executing the sudoa2enmodrewrite command on the terminal, the Mod_rewrite module is enabled. Alternatively, you can connect the etcapache2mods-availablerewrite.load to
Apache mod_rewrite is a killer module that provides powerful URL operations. it can implement almost all URL operation types you dream of. The price is that you must accept the complexity, because the main obstacle of mod_rewrite is that it is not
When mod_rewrite is used for rewriting, the rules are complex,
After a one-click test, note the following two points:
1. Generally, the negative character ^ in the regular expression is not applicable. Use it!
2. the URL after rewriterule is
Apache mod_rewrite is a killer module that provides powerful URL control. it can implement almost all URL control types you fantasized about. the price is that you must accept the complexity, because mod_rewrite is an important obstacle, it is
We know that the search engine is preference for static pages, so, put such as: http://www.jianglb.com /? Change the p = 123 page to http://www.jianglb.com/apaeche-rewrite.htmlto show benefits for searching.However, if the address file does not
Method One:One of my rules1, rewriterule ^ (. *)/111/$1 [r,l]with Curl testing, there is no problem, but there is an infinite loop when using browser access. was originally visited byWww.111.comthe result
The rewrite experience of Apache
Recently, the company to transfer the server, the server has dozens of sites are running, want to transfer the period, the service is not affected, so with the Apache Mod_rewrite did some processing.
The general
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.