Recently, our company's website is being optimized. If we want to adopt a better technology, we can make it easier for Google and other search engines to generate dynamic php web files, at present, we have adopted some improvement methods: for example, using PHP in the backgroundProgramChange the original file to the HTM content. The Apache path_info technology is used, but it is not powerful enough. Therefore, we decided to use the
Here is the implementation example:
Copy Code code as follows:
/*
* Pseudo address to the original address (Url_alter)
*/
Function Example_url_inbound_alter ( $path, $original _path, $path _language)
{
if (Preg_match |^article (/.*) |, $path, $matches)) {
$path = ' node '. $matches [1];
}
}
/*
* Original address to the pseudo address (Url_alter)
*/
Function Example_url_outbound_alter ( $path, $options, $original _path)
{
if (P
. Application Conditions of Rewrite Rules
---- When your Web request is directed to the Apache daemon of a Web server, Apache determines whether the request is a master configuration or a virtual host based on the configuration file, then, the rewrite rule is matched based on the URL requested by the user in the browser and based on the actual Request Path.
based on the URL requested by the user in the browser and based on the actual Request Path. rewrite Rules in htaccess, and finally return the request content to the user. There may be two types of responses.
---- 1. Redirect the external request content (redirect) to another URL
---- Let the browser send a request again with a new
,.flv and suffix The code is as follows:Copy code Location ~ . *. (Sh | flv | mp3) $ {Return 403;}Set the browser cache Time for some types of files The code is as follows:Copy code Location ~ . *. (Gif | jpg | jpeg | png | bmp | swf) $ {Expires 30d;}Location ~ . *. (Js | css) $ {Expires 1 h;}Comparison between Nginx and Apache Rewrite rule instancesGenerally, simple Nginx rules are slightly different from Apache rules and are fully compatible
the parameters after the jump to remain consistent.
For example: http://bbs.abc.com/post/addpost/913.shtml jump to Http://www.abc.com/bbs/post/addpost/913.shtml
Location/post {
Rewrite (. +) http://www.abc.com/bbs$1 permanent;
}
V. URI-based jumps
if ($request _uri ~* ^/note\.php\?product_code= (. *) $) {
Rewrite (.
First, the preface
In fact, the rewritten JDBC Data-source is run in the servlet, looking for a data source through Jndi. I use the Orion trial, the site of the "Java/jsp Learning series of six (MySQL page example)," a simple rewrite.
Second, the configuration
(1) Jdbc
Need to use JDBC driver copy to [Orion]/lib directory
(2) Data-source
Add the following in the [Orion]/config/data-sources.xml file:
js|mysql| Page One, preface
In fact, the rewritten JDBC Data-source is run in the servlet, looking for a data source through Jndi. I use the Orion trial, the site of the "Java/jsp Learning series of six (MySQL page example)," a simple rewrite.
Second, the configuration
(1) Jdbc
Need to use JDBC driver copy to [Orion]/lib directory
(2) Data-source
Add the following in the [Orion]/config/data-sources.xm
Last introduced how to use Nodejs + PHANTOMJS for screenshots, but because of each screenshot operation, has enabled a PHANTOMJS process, so the concurrent volume up, the efficiency is worrying, so we rewrite all the code, and its independence into a module, convenient to call.How to improve? control number of threads and the number of single-threaded processing URLs. Use standard Output WebSocket for communication. Adds a caching mechanism that is c
Apache rewrite example setForward one domain name to another in httpdThe VM domain name has recently changed. The new domain name isWww.wbhw.comTo make it easier to remember. In this case, you need to direct the original domain name webhosting-world.com, and the address of the Forum webhosting-world.com/forums/ to the new domain name, so that the user can find, and make the original Forum
of URL rewriting, because the URLs provided to users do not make any sense to users, nor provide them with any "deletable ". Therefore, let's use URL rewriting so that when users access/products/beverages. aspx, their URL will be rewritten to listproductsbycategory. aspx? Categoryid = 1. We can use the following URL r
first, what is the routing mechanism of PHP
1, the routing mechanism is to extract a particular form of the URL structure of the system corresponding parameters. For example, such as: HTTP://MAIN.TEST.COM/ARTICLE/1,/ARTICLE/1, _m=articleid=1.
2, and then the corresponding parameters of the URL into a specific form of the URL
ASP.net address rewriting (URLRewriter) implementation principle and code example Gao Lu I. Overview of visitor input: Unknown, Which is UrlRewrite, in addition to implementing the second-level domain name function, it plays an important role in simplifying user input addresses, SEO, and iterative website version updates. Microsoft once. net framework 1.1 provides a small tool named URLRewriter for developers to easily implement UrlRewrite, for: http:
When developing a Web program, we usually need to optimize the web access address to optimize the search engine (SEO), such as http: // localhost/Default. aspx? Tab = performance is changed to http: // localhost/Default_performance.aspx. The last address can be better searched by the search engine, thus optimizing the search engine. Microsoft has an open-source class library URLRewriter that can easily rewrite URLs by configuring them on the web. the
thinkphp URL Rewrite problem example detailed
In the process of using thinkphp, it is often necessary to remove the index.php in the URL path, because it is really awkward. The desired result is to remove the index.php from the URL path.
First, configure the. htaccess
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.