apache|js|seo| level two domain name | Optimizing Apache took a long time, but it took a long time to say that mastery is far from enough. So this four or five days there is a lesson in the taste of the inside: since the company can not provide a good system administrator, can only be a self-concurrently. After the combination of Apache and Tomcat to optimize the processing of SEO, four or five days later, the basic logic of these tools have a unified understanding of the framework.
The understanding of URL rewriting needs to be tailored to the needs of SEO in favor of HTML, as well as the provision of a two-level domain name to facilitate module management and promotion. Search engines can not know the dynamic page is technically impossible; I think the biggest possibility is that for static hardlink, if there is no search engine will get a 404 logo, and for dynamic pages, the response is not necessarily. This will not facilitate the search engine on index maintenance and subhead.
After an in-depth understanding of Apache mod_rewrite, it is found that several key guides are often missing in its documentation and introductory articles, and that the details are too fast to be involved. To understand Mod_rewrite's work, the first thing to understand is that Mod_rewite is working on a directory. In other words, the rewriterule of each directory is separate, and each directory rewrite is both the highest and lowest of the containers, so rewriterule is defined in the location of each directory, <directory $dir/> or in the. htaccess of the directory.
Second, mod_rewrite is a flat rule collection that lacks logical functionality, so each directory setting is a regular, repetitive conversion, [L] just indicates that once the match is over, it needs to be matched again, and there is no entry to match it before outputting the request, If the rule is slightly more not only the performance will be plummeting, but also very easy to fall into chaos, so mod_rewrite to use carefully, using mod_rewrite to match the level two domain name to be careful. In this case, the Mod_rewrite designer expects to use regular expression matching or allow the user to invoke Perlshell as a complex matching logic application. But this makes development more complicated.
Because the mod_rewrite is directory-level based, it has a lower priority than the virtual host setting, and the VirtualHost host has a lower priority than Virtualdocumentroot's pan-virtual host settings. Because the virtualhost servername based on IP header matching can not use regular expressions, therefore, the use of Virtualdocumentroot set multi-level domain name there is a very large limit, the application of a slight diversification will face insurmountable conflicts. Therefore, simply using a virtual host or URL rewrite is not very efficient, then the main path should be the use of HTML guidance, so that both to meet the requirements of SEO like hardlink, will not affect the user's browsing; most importantly, The main solution can be centralized into the areas of one application, simplifying the project technology and reducing the cost of the project.
Sites using mod_rewrite and level two domains are basically using PHP for a reason: consistent maintenance of the session. There is a lot of complexity when mod_rewrite is applied to a JSP site. Because the mod_rewrite is for the directory, it is bound to interfere with the operation of the directory, and the context of the JSP is based on the base directory as the application of the decision, so that, in a clear directory, JSP in different domain names and virtual host under the normal recognition of the maintenance of the session, But once the directory is not complete, like using a level two domain name, whether this directory interpretation from URL rewriting or virtual host settings, the browser will consider it as two session requests, resulting in confusion. Therefore, in the JSP site using the level two domain name, in addition to the use of hard HTML Connection guide, there is no other way. Of course, the use of redirect way to solve the problem, on the surface, but such words will lose the meaning of SEO, and URL rewriting is to be done for SEO; then why rewrite it?
Moreover, this domain/path and session relationship, different browser performance is not the same. IE is only relevant to the context path, but Firefox/mozila/netscape is also related to the domain name (level two domain name). In this way, if you do not want to cause confusion, it is best to set the boundaries of rewriting, in a place to stop, just rewrite as a portal, while the other, the complete primary domain name for the main domain. It also means that the relative path is unreliable for both the picture and the static dynamic file. As for the loss of the session due to the path change, either browser will automatically remove the session, resulting in the loss of the session.
In summary, the URL in the/.htaccess two-level domain name rewrite, preferably from the beginning to write redirects to the standard host and path, so that you can save a lot of trouble behind, at the same time, for SEO, does not affect the 蜮 name itself is assigned value.