In the development of a variety of complexity sites sooner or later requires the use of redirect. For example, to update the page, chat or online transfer to redirect to the correct address in the case of “Perez” pages, etc. Correct use redirect or refresh the page can make the work site more efficient and to do for users.Redirect (from the English. redirection) – Peoria, redirecting the user to another page of the site. Usually means the automatic redirect parades, without user intervention. Redirect can be called a software solution (script) that redirects a user from a page pose to another.
When it is useful to apply the redirect.
- The pros At site at the new den. Website visitors at the star, it is desirable to automatically redirect to another den;
- When you move pages or sections of a site. The redirect is applied to perversion users to the new, correct address of the page or section. It is very important to keep the nearest site and information accessible;
- To update the page periodically. The update page is kind of a special case of a redirect page on the saw myself, but sad at the time! Useful on sites with text and translations, to chat.
- When the position of the website. Simple Redirect, for example, the result of the “Clay” Andres pages with the www prefix and without it;
Accurate and correct use of 301 redirects of old pages to new or old site to a new address, allows you to save the position of the site in the paw systems. Using 301 redirect sends PageRank for the page to the new address.
Let’s say we had after all a site with lots of visitors islam. The site was then moved to the new den. The search engine doesn’t know him yet. 301 redirect allows you to sort of “cut” the old and new address, while retaining all the elements of optimization that have been made for this site, thereby preserving the attendance and audience of the site itself.
You can also use the redirect to hide your affiliate link and thus save your commissions. Typically, a partner link contains your partner ID, by which the program partner software identifies and counts sales based on your recommendation. It so happens that users knowingly or by some incomprehensible any cut off the “tail” of your partners links With your ID and go to the site at the right address.
Methods of implementation of the distortion of the sites.
- Simple redirect (in the file .or htaccess in the httpd file.in the conf file for Apache)
- For the use of the mod_rewrite module perversion
- Redirect in PHP
- Redirect in ASP
- Redirect to ASP.NET
- Redirect using Meta refresh
Redirect means .htaccess
Directive, propane file .open file. the “Apache”server is processed by htaccess. Here are a few working primer perversion:
1.Redirect 301 / http://best-news.pro/
3.Redirect 302 / http://best-news.pro/
More complex solutions, but very useful, can be used when the Apache module — and mod_rewrite are connected. The commands for the mod_rewrite module are written to the file .htaccess.
Example saudi file .rewrite using the mod_rewrite module:
RewriteRule (.*) http://best-news.pro/ / $1 [R=301, L]
If this file .htaccess or be placed on another den, any queries will be automatically routed to the 301st redirect on the website google.com. The address of the pages visited will be saved. A similar redirect can be used with a pair of “parish” domains, for example, to transfer its replaceable number to the location.
A 301 redirect is called EPS! This redirect reports that the page is permanently Persona to a new address. This fact is well defined by the Palace systems and almost all the poles parameters of the old page are transmitted to the new one. For example, factors such as SSL, etc, etc 301st redirect page in a new dress as a rule does not lose its position in the paw systems, which makes this the advantages of the pages and sections of the website the nest for visitors and without compromising the traffic of pow systems.
Redirect in PHP
As we have noticed earlier, to perform redirection script on the server must send a special title to the browser pastel. In PHP programmer language, sending headers with redirect can be done using the header function().
Header (“HTTP / 1.1 301 moved permanently»);
Title (“location: google.com”); / * browser redirection */
/ * Make sure that the code below does not execute when we redirect. */
Redirect in ASP
<%@ Language=VBScript %>
Answer.Status=”301 Moved Permanently»
Answer.AddHeader “Location”, “http://www.new-url.com»
Redirect to ASP.NET
< script runat= “server”>
private void(object sender, system.Eventargs e)
Answer.Status = “301 Moved Permanently»;
Answer.AddHeader (“location”, ” http://www.new-url.com»);
Redirect using Meta refresh
<Meta http-equiv= refresh content=’0; URL=http://best-news.pro/’>
where 0 — second delay in perversion, newdomain.com -page where we will pass. Some older browsers do not support Meta refrain with a value of 0, you can sometimes set a nonzero value, although in my opinion it is no longer real. Such a redirect will not be able to slit your sites (with www and without and) to convey, etc., as ignored Palace systems. It returns a code of 200 OK, which corresponds to a normal page. This technique is popular with spammers, so it should only be used for pages that are not indexes.
setTimeout (‘document.forms [“searchform”].Represent.press ()’, 100);
On the “Send” button you can pest any action, for example, open a new URL in this window.
?location = “http://www.newdomain.com»;
In the latter case, it will be impossible to return to the page that performed the perversion, since its address is a story from the street, which is sometimes necessary.
Conclusion. EPS method redirect the old pages to the new or old site to the new address, with the banal in positions of pow systems, is to use 301 redirect, which will also allow you to pass old page Rank to the pages on the new site.