How to set up 301 one page to another?

clarkma

Newbie
Joined
Sep 5, 2016
Messages
40
Reaction score
4
How to set up domain 301 from a.com/pagecontent.html to b.com/pagecontent.html? I think when i set up domain 301 it will work for all pages, but no. Type a.com it will redirect to b.com, but no reaction for a.com/pagecontent.html.

Need some help!!!
 
How to set up domain 301 from a.com/pagecontent.html to b.com/pagecontent.html? I think when i set up domain 301 it will work for all pages, but no. Type a.com it will redirect to b.com, but no reaction for a.com/pagecontent.html.

Need some help!!!

Add to .htaccess on the old site:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

Replace "olddomain" and "newdomain" as appropriate.

If you aren't comfortable, familiar with or able to edit .htaccess then use Cloudflare page rules

The solution is to use variables. Each wildcard corresponds to a variable when can be referenced in the forwarding address. The variables are represented by a $ followed by a number. To refer to the first wildcard you'd use $1, to refer to the second wildcard you'd use $2, and so on.


To fix the forwarding from the root to www in the above example, you could use the same pattern:

example.com/*

You'd then set up the following URL for traffic to forward to:

http://www.example.com/$1
In this case, if someone went to:

example.com/some-particular-page.html

They'd be redirected to:

http://www.example.com/some-particular-page.html
 
Use .htaccess as suggested by @Trolling4Dollars.

If you do not want to use .htaccess, install redirection plugin and create a wild card redirection.

a.com/* to b.com/*
 
Add to .htaccess on the old site:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

Replace "olddomain" and "newdomain" as appropriate.

If you aren't comfortable, familiar with or able to edit .htaccess then use https://support.cloudflare.com/hc/en-us/articles/200172286-Configuring-URL-forwarding-or-redirects-with-Cloudflare-Page-Rules
Thank you, I will try out.
 
You can do it through c panel ... go to the c panel under redirection section choose the domain to redirect from the menu. If you want to redirect a specific page, enter it into the box to the right of the slash (example: mysite.com/page1.html)
 
Back
Top