Permanent redirects a Web site to a new one old [Redirect web domain in .htaccess]

When we give up an old web site in exchange for a new one, it is good to keep the visitors of the old site and redirect them automatically to the new one. In this situation there can be two scenarios.

1. The new web site is installed on the same domain name on the web site was also Vechiu.

In this situation it is best to we keep the URLvalid for all old pages, and if this is not possible, the missing URLs will need to be redirected either to new, relevant pages, or to the index of the new web site (first page or home page).
The extemplu if the old web site have web address "http://numedomeniu.com/servicii.html", It is indicated that this address also exists on the new web project. If this is not possible, a permanent 301 redirect will have to be made to a new relevant address or to the "home page", using the file..htaccess.
In this scenario, we open and edit the file..htaccess from the root of the domain (public, public_html most of the time). We add the lines:

Redirect 301 /servicii.htmlhttp://numedomeniu.com/portofoliu.html

Old page "servicii.html"It will be automatically redirected to the new page 'portofoliu.html".
To redirect the "services.html" page to the index of the web site, we use the line:

Redirect 301 /servicii.html http://numedomeniu.com/

2. The new web site is installed on a new domain name and want to do redirection from the old to the new domain name.

In this scenario, note that you need it hosting (Web Hosting Services) for both domains. At least for a while, until the old domain name is no longer present Google Searchon business cardsflyersEtc. ads.
Redirecting all Web pages from the old site to the first page of the new web site will be adding..htaccessCPC old project lines:

<IfModule mod_rewrite.c> Options +SymLinksIfOwnerMatch RewriteEngine on RewriteCond %{HTTP_HOST} ^numedomeniuvechi.com [OR] RewriteCond %{HTTP_HOST} ^www.numedomeniuvechi.com [NC] RewriteRule ^(.*)$ http://noulnumedomeniu.com/ [L,R=301] </IfModule>

Once made these changes, our old web site will be automatically redirected to the new website.

Redirection using file 301 .htaccess It is available only web servers using Apache (HTTP Server) With mod_rewrite module enabled (mod_rewrite.c).

Permanent redirects a Web site to a new one old [Redirect web domain in .htaccess]

About the author

Stealth

Passionate about everything gadget and IT, I write with pleasure on stealthsettings.com since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment