Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 8th Jan 2012, 07:39 PM   #1
Ninja Warrior
War Room Member
 
Join Date: 2011
Location: asd
Posts: 283
Thanks: 44
Thanked 26 Times in 19 Posts
Default
301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

Hello,

I've searched all over for a simple answer (and probably missed one) for my problem. I'm trying to redirect a domain, including all sub pages, to a new site. The new site is identical to the old one, except the name and domain name changed. Using my Bluehost cPanel I set up a wildcard 301 redirect from:

http://www.oldsite.com

to

http://www.newsite.com

It works. The problem is, my old sub pages and posts are ranking pretty well in search engines, and they are not redirecting. So if someone clicks on...

http://www.oldsite.com/post-that-ranks-well

...it doesn't redirect to:

http://www.newsite.com/post-that-ranks-well

Can anyone help with this? I'd love to figure it out soon so my old site can't be accessed and can be phased out of the SERPs.


Thanks,

Brock
bmcgoff is offline  
Unread 8th Jan 2012, 08:42 PM   #2
VIP Warrior
 
mojojuju's Avatar
 
Join Date: 2005
Location: Potemkin Village
Posts: 1,724
Thanks: 745
Thanked 742 Times in 498 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

I'll assume that this site is running on the Apache webserver and that mod_rewrite is enabled...

In the root of your web site (public_html folder) create a file called .htaccess if it doesn't exist, or edit it if it does exist (don't forget to create a backup).

In your .htaccess file, add a line at the top that reads:
redirect 301 / http://www.YourNewDomain.com/
That's all. Test to see that it works.
mojojuju is offline  
Unread 8th Jan 2012, 09:57 PM   #3
Ninja Warrior
War Room Member
 
Join Date: 2011
Location: asd
Posts: 283
Thanks: 44
Thanked 26 Times in 19 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

Mojo,

Thanks. This is a WordPress.org blog hosted on Bluehost, but other than that I have no idea about the backend technical side of things. I already created the redirect, which I'm assuming modified the htcaccess file like you said. The redirect is working, just not for the sub pages.

Make sense?


-Brock
bmcgoff is offline  
Unread 8th Jan 2012, 10:50 PM   #4
Ninja Warrior
War Room Member
 
Join Date: 2011
Location: asd
Posts: 283
Thanks: 44
Thanked 26 Times in 19 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

FYI here's what my .htaccess contains:

RewriteEngine on
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress RewriteCond %{HTTP_HOST} ^amazonaffiliatesblog\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.amazonaffiliatesblog\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.brockstarlife\.com\/$1" [R=301,L]
bmcgoff is offline  
Unread 8th Jan 2012, 11:08 PM   #5
VIP Warrior
 
mojojuju's Avatar
 
Join Date: 2005
Location: Potemkin Village
Posts: 1,724
Thanks: 745
Thanked 742 Times in 498 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

You can do it simply by editing your .htaccess file and adding a line to what you've already got so that your .htaccess file looks like this:

RewriteEngine on
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
redirect 301 / http://www.YourNewDomain.com/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress RewriteCond %{HTTP_HOST} ^amazonaffiliatesblog\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.amazonaffiliatesblog\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.brockstarlife\.com\/$1" [R=301,L]





Or, you could just delete your .htaccess (make a backup) and do what I said earlier and create an .htaccess file with nothing but this line in it:

redirect 301 / http://www.yournewdomain.com/

That will redirect everything.
mojojuju is offline  
Unread 9th Jan 2012, 10:27 AM   #6
Ninja Warrior
War Room Member
 
Join Date: 2011
Location: asd
Posts: 283
Thanks: 44
Thanked 26 Times in 19 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

Worked perfectly. Thanks very much! Should I delete the Bluehost redirect that I created or does that even matter?

Thanks again,

Brock
bmcgoff is offline  
The Following User Says Thank You to bmcgoff For This Useful Post:
Unread 9th Dec 2014, 02:13 AM   #7
Warrior Member
 
Join Date: 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: 301 Wildcard Redirect For The Common Man...
Share on: 
fb share twitter share gplus share more share

Hi dont redirect with wildcard ! what ?
http://upload.seorooz.ir/do.php?imgf=Capture2.png http://upload.seorooz.ir/do.php?imgf=Capture_52bf8.png
domain seorooz.ir redirect to domain seorooz.net but posts not redirect !example:seorooz.ir/webdesign .
How do I do this too redirects to seorooz.net/webdesign ? I appreciate your help. I’m afraid to fall site
RewriteOptions inherit
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RewriteCond %{HTTP_HOST} ^seorooz\.ir$ [OR]
RewriteCond %{HTTP_HOST} ^www\.seorooz\.ir$
RewriteRule ^/?$ "https\:\/\/seorooz\.net\/" [R=301,L]

hamedi is offline  
Closed Thread


Bookmarks

Tags
301, common, man, redirect, wildcard


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 02:17 PM.