301 Wildcard Redirect For The Common Man...

6 replies
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
#301 #common #man #redirect #wildcard
  • Profile picture of the author mojojuju
    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.
    Signature

    :)

    {{ DiscussionBoard.errors[5386454].message }}
  • Profile picture of the author bmcgoff
    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
    {{ DiscussionBoard.errors[5386869].message }}
  • Profile picture of the author bmcgoff
    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]
    {{ DiscussionBoard.errors[5387131].message }}
  • Profile picture of the author mojojuju
    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.
    Signature

    :)

    {{ DiscussionBoard.errors[5387206].message }}
  • Profile picture of the author bmcgoff
    Worked perfectly. Thanks very much! Should I delete the Bluehost redirect that I created or does that even matter?

    Thanks again,

    Brock
    {{ DiscussionBoard.errors[5390150].message }}
  • Profile picture of the author hamedi
    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]
    {{ DiscussionBoard.errors[9728150].message }}

Trending Topics