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

When we quit an old web site in exchange for a new one, it's a good idea to keep visitors to the old site and automatically redirect them to the new site. In this situation there may 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 I keep the URLvalid for all old pages, and if this is not possible, URLs that no longer exist should be redirected either to new, relevant pages, or to the index of the new web site (home page or home page).
The extemplu if the old web site have web address "", It is advisable to have this address on the new web project. If this is not possible, 301 should be permanently redirected to a new relevant address or 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). Add the lines:

Redirect 301 /servicii.html

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

Redirect 301 /servicii.html

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 cards, flyersEtc. 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} ^ [OR] RewriteCond %{HTTP_HOST} ^ [NC] RewriteRule ^(.*)$ [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


Passionate about everything that means gadget and IT, I am pleased to write on from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment