htaccess redirect all pages to homepage?

Paul Wellner Bou

Well-known member
Registered
Joined
Apr 20, 2016
Messages
95
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
Registered
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
Registered
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]
 
Latest Threads
Replies
1
Views
26
Replies
0
Views
189
Replies
1
Views
40
Replies
2
Views
83
Recommended Threads
Replies
0
Views
1,725
Replies
7
Views
4,069
jms
Replies
4
Views
3,113
Replies
0
Views
2,580
Similar Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

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