htaccess redirect all pages to homepage?

Joined
Apr 20, 2016
Messages
45
Points
6
can any one share me htaccess codes to redirect all pages to homepage, on the old domain names I didn't use it any more but I have got a new domain, but pages on old domain names were indexed by Google, I want to redirected all its pages to homepage or to new domain name. How can I do that?
 

NickR

Active member
Joined
Jan 14, 2017
Messages
84
Points
8
Try adding this in your .htaccess:

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.examplenewdomain.com [R=301,L]
If you really want to properly redirect an old domain to a new one, then you're better off (SEO and UX-wise) to redirect all old pages to the new, appropriate ones.

So, as an example:

If you have olddomain.com/blue-cars.html, olddomain.com/red-cars.html, olddomains.com/category/cars/ redirect those to newdomain.com/cars.html

Don't just redirect everything to the homepage. Sure, it might take some time to do it, but it's far better and safer to redirect them to the appropriate page.
 

cubetechnolabs

New member
Joined
Feb 10, 2017
Messages
1
Points
0
Try This code:

Code:
RewriteEngine on
RewriteCond %{http_host} ^www.old.com [NC,OR]
RewriteCond %{http_host} ^old.com [NC]
RewriteRule ^(.*)$ http://www.thenewdomain.org/ [R=301,NC,L]
 
Newer Threads
Replies
3
Views
1,869
  • Deleted
  • Deleted by N/A
Replies
0
Views
6
Latest Threads
Replies
0
Views
1
Replies
0
Views
11
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
Replies
3
Views
126
Similar Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top