How to properly configure domain forwarding synonym. Configuring the Domain Forwarding service. Domain redirection in .htaccess file

Good afternoon, my readers! I think this material will be very interesting for you! Let's talk about what a domain-to-domain redirect is. Imagine, you type the site president.ru, and after that, it goes to yours! And now you already have hundreds of thousands of fans.

What is a redirect?

301 redirect is a redirect from one site to another.

Also, it is possible to transfer without hosting from one page of the site to another. How to do this, we'll talk about it in today's blog.

Htaccess itself 301 redirect it is necessary for the programmer and web designer, so that he can go from one subdomain to another. For example, it is not uncommon for a good and high-quality site to suddenly fall under the "search engines" filters. At the same time, those readers of the Internet resource who store it in their bookmarks of search engines or have a subscription to rss news, dialing the address they already have, go to "Filtered" website.

In addition, redirect is used to have a main project, to increase its ranking in search engines, and by buying a new "advanced" domain and redirecting to your own Internet resource. Thus, the rating of your portal also increases.

Finally, you need to use a redirect to switch from free hosting to its paid equivalent.

How to make a 301 redirect?

To make a redirect, you should find the htaccess file in the root folder (the root is the folder where your site is located). Typically, these are server folders that can be accessed via ftp like www, domains, or / public_html or HTDOCS. Further, to go from site to site, you need to write a code (or copy and paste it)

Redirect 301 / old-page.html http: //new-domain.com/new-page.html
or
Redirect permanent / old-page.html http: //new-domain.com/new-page.html

You can also use one more redirect in order not to add links for URLs in htaccess

RedirectMatch /(.*)\\.php$ /$1.aspx

For your reader to be redirected from a site to another, you should use the following entry:

Redirect / http: //www.domain.com

301 redirect from domain withwww without looks like this:

RewriteEngine on
RewriteCond% (HTTP_HOST) ^ www.nic.ru
RewriteRule ^ (. *) $ Http: // www.nic.ru / $ 1

301 redirects from a domain without www to www:

RewriteEngine On
RewriteCond% (HTTP_HOST) ^ timeweb.com
RewriteRule (. *) Http: // www. timeweb.com / $ 1

To redirect Cyrillic domains, you need to use the punucod converter. To do this, the address you already have (for example, president.rf) using the service http://wwhois.ru/punycode.php (by entering the site) must be changed to www.xn - d1abbgf6aiiy.xn - p1ai.

Experienced programmers can also redirect a domain to a web address - DNS web direct. But this is already a higher level.

As an example, try to redirect the following domains yourself http://2domains.ru/, http://timeweb.com, https://www.nic.ru.

It is very convenient to use the domain forwarding service http://2domains.ru/. It allows you not only to redirect your domain to another address, but also have an unchangeable address of your page without hosting and changing the provider. Also, you can use this service to register an additional domain.

Owning one page, for example mypage, you can purchase a fully qualified domain name on the main section of the site www.mypage.ru/mybrand/index.html. This allows you to do direct advertising of an Internet resource, and readers will directly indicate your resource's web page address and find the landing page!

In addition, using the multiple redirect service, it is easy to redirect from one site to others if necessary.

You can also independently come up with ways to use a redirect. It's very convenient and simple! One has only to try! Try it!

That's all for today. Subscribe to updates. Looking forward to your comments, see you on the next blog! Bye Bye.

Best regards, Roman Chueshov

Good afternoon, my dear listeners / readers / caretakers

Today I will tell you about the correct gluing domains and 301 redirects through the htaccess file.

Honestly, I haven't written for a long time, it's all about my personal time - unfortunately, it is not rubber and it has been sorely lacking lately. My wife is in the maternity hospital, so the son and all the household chores rests on me, and if you consider that I still conduct training and I have my own students - you can imagine how much time I have.

But let's get down to business!

Why is it so important that the site be glued together, or rather a domain?

The fact is that search engines (like Yandex and Google) see not one site, but two. Let me explain:

Let's say I have a domain seregakolt.com, and search engines see two of them.

First seregakolt.com

Second www.seregakolt.com

Those. the same site with and without www - search engines perceive them as two different resources.

What are the consequences of this? Yes, the most sad!

But as for the search engines - they will perceive them as links to different sites and you will simply lose some of the links! Those. part of PR and TIC will go to another domain.

It turns out that if you promote a site without www - and the search engine first found a site with www, then a site without www will be perceived as a duplicate - and all your efforts will be in vain, as it will simply drop out of the rating !!!

This way you will lose visitors!

Naturally, when you glue your domain, all links will lead to one site, with or without www. As you choose. And the search engine will treat everything as one site, preserving its authority.

I know that this is pure stupidity, but this is how our search engines are arranged, and since they bring the lion's share of visitors, it means that their fastidious nature and stupid jumps should be taken into account and taken seriously!

How does 301 redirect and domain splicing work?

Everything is trite simple - the main mirror is indicated to the search engines and they transfer the weight of the links to it!

Moreover, you can glue completely different domains! Those. if your site was previously on one domain, and you want to transfer it to another, but at the same time not lose links, TIC and PR - domain gluing will help you.

You can see an example right here. Try to type and you will be transferred to the site anyway

And www will be removed from any links to my site. And if someone puts a link from www, the search engine will transfer all its weight to the domain site

Making a 301 redirect via .htaccess file

There is nothing difficult in this! Everything is done by simple editing (creation and editing) of the file in a regular notepad.

Those who have - can easily just edit this file - it comes with the system!

If you do not have this file, then we just create it, the file name .htaccess - without any extensions!

Perhaps Windows will show off and say that you need to set a name - then create this file through Total Commander or create it in any editor (you can use a regular notepad).

In most cases, it comes with the CMS and must be hosted in the root directory of the site.

If it is not there, create and post it.

If so, just edit.

Now decide which domain you want to make the main one and follow the instructions below!


Redirecting 301 from www to non-www:

Open this file and add the following code to it:

Options + FollowSymLinks RewriteEngine On RewriteCond% (HTTP_HOST) ^ www.domain.com RewriteRule ^ (. *) $ Http://domain.com/$1

Please note that the last two lines must go immediately after the line RewriteEngine On - it is important!


And vice versa from without www to www: RewriteCond% (HTTP_HOST) ^ domain \\ .com $ RewriteRule ^ (. *) $ Http://www.domain.com/$1

Just write these instead of the last two lines.

If you have this file, and it contains some of these lines, but there is a sign in front of them # - this means that the line is commented out and has no effect.

Take it away!


301 redirects from one domain to another: RewriteRule (. *) Http://www.newdomain.com/$1

We insert this line instead of those two.

MANDATORY:

1. There should be a line Options + FollowSymLinks

2. There should be a line RewriteEngine On

3. Lines with a redirect must go IMMEDIATELY after the RewriteEngine On line

4. The .htaccess file is named this way, nothing else!

5. The .htaccess file must be in the root directory!

6. Domain.com - don't forget to change to your own domain.

Basically, that's all. But 301 redirects are well understood by Google, but for Yandex you need to edit / create another file. So the step below is a must!


Domain gluing for Yandex:

Again, go to the root directory of the site and look for a file called robots.txt, if not, create it in a regular notepad.

Place the following code in this file:

User-agent: Yandex Disallow: Host: domain.com

If you have this file, but these lines do not exist, then add them at the end through a paragraph.

Specify the main mirror in the Host line - do not forget to put your domain

For those who order promotion from individuals and companies.

Of course, this is a very rare case, but still ... Forewarned is forearmed!

Sometimes malicious SEOs can glue their domain to yours and promote themselves.

And if after a while you stop cooperation, he can safely remove the redirect from his domain to yours, and all the promotion for your money will go to the thief.

Moreover, your site may have a robots.txt file with the main mirror to his site.

Be carefull! And demand constant work reports.

Thank you for your attention, Seryoga was in touch!

If you have any questions, ask in the comments.

Periodically, our clients contact us with the question of how to redirect a site from one domain to another. Typically, this question is asked in two ways:

    the site opens at 2 addresses:www.mysite.ua andmysite.ua (for search engines this is a significant difference and they perceive 2 addresses as 2 different sites), therefore, it is necessary to make sure that when accessing the pages of the site withwww,there was a redirect to the same pages of the site withoutwww,for example with http: // mysite.ua/ news / onhttp://www.mysite.ua/news/ ( or vice versa).

    you have multiple domains, main mysite.ua and alternative my-site.ua and / or Cyrillic moisite.ukr... It is necessary that when typing the address my-site.ua and / or moisite.ukr in the browser, the visitor is automatically redirected to the site mysite.ua.

1. Domain redirectionin file.htaccess .

1.1. From www domain to main domain

If your server has the module enabledmod_rewrite then that hto set up redirection from addresses starting with www to similar ones without www, you need in the file .htaccess, in the root folder www of your site, write the following lines:

RewriteEngine On RewriteCond% (HTTP_HOST) ^www .(.+)$ RewriteRule ^ (. *) $ Http: //% 1 / $ 1

1.2. From main domain to www-domain

RewriteEngine On RewriteCond% (HTTP_HOST)! ^ (www .) RewriteRule ^ (. *) $ Http: //www .% (HTTP_HOST) / $ 1

1.3. From one domain to another

The task can be solved in the same way as the first, to set up redirection of visitors from one domain domain1.ua name to anotherdomain2.ua you can use the appropriate directives in the file.htaccess .

Make on the old domaindomain1.ua htaccess file, with content:

RewriteEngine On RewriteCond% (HTTP_HOST)domain1. ua RewriteRule (. *) Http: //domain2. ua /$1

1.4. Redirecting from multiple domains

Need to redirect from domains domain1.ua and www.domain1.ua to a new domain domain2.ua, for this write:

RewriteCond% (HTTP_HOST) ^ domaim1 \. ua RewriteRule ^ (. *) $ Http: / / domain2.ua /$1 RewriteCond% (HTTP_HOST) ^ www. domain1 \. ua RewriteRule ^ (. *) $ http: // domain2.ua /$1

Similarly, you can do overdirection with domain.ua on domain.com etc.

However, if you are hosting on a tariff plan with a limited number of domains included in the tariff, then setting up a site with only one .htaccess file will deprive you of one more domain in the tariff quota, which is not always acceptable. In this case, you can use a special service of the hosting control panel.

2. Domain redirection in the hosting control panel

On the example of the control panel "cPanel"

You can choose between 301 and 302 redirection options.

301 redirect is a permanent redirect. Those. when a 301 redirect is installed, everyone, including search engines, will be informed that the requested page has “moved” to the new address forever. Such a redirect is necessary, for example, when moving from one domain name to another. Thus, you will not lose search traffic, and search engines will be notified about the change of address.

302 redirect is a temporary redirect. Thus, users calling a page with a 302 redirect will receive a response from the address specified in the redirect. However, in search engines, the old address will remain and will hold its positions.

Also, you can select the redirect options associated with the site synonym www. Please note that redirecting from the domain http://www.site.ua/ to http://site.ua/ cannot be done using cPanel. A similar redirect is created using the file .htaccess.

The redirection control looks pretty standard. You can remove the created parameter:

3. Redirecting Cyrillic domains

Redirection of Cyrillic domains is no different from the usual (in Latin). You just need to use the punycode converter.

Punycode Is a method of converting Unicode characters into a sequence of characters containing only ASCII characters, namely 26 Latin letters (a-z), numbers (0-9) and a hyphen (37 characters in total).

Domains containing national alphabets are called IDN domains. Some services do not support IDN domain representation. Therefore, the UKR domain or other IDN domains does not work. In this case, you need to use the domain name after Punycode conversion.

For example, domain http: //myisite.ukr/ after coding (you canuse the service http://wwhois.ru/punycode.php)becomes , that's what we write into the already familiar code

RewriteEngine On RewriteCond% (HTTP_HOST)http: //xn--80arbjktj.xn--j1amh/ RewriteRule (. *) Http: //domain2. ua /$1

or in the corresponding line in the control panel.