Results 1 to 6 of 6
  1. #1

    301 redirect in htaccess question

    htaccess

    I have a bunch of listings in google for a domain I bought.
    Like domain.com/forumdisplay.php?f=3434 blah blah

    How can I get these old extensions to redirect to a certain domain name. I want all of the ones in google, instead of being 404, to forward to a domain name I have. And I want to use 301 redirect, not 404 redirects. I also nee www, and non www to redirect to the www of this other domain.

    Thanks

  2. #2
    I can use the general cpanel redirect for the main domain, and for the file urls that would be 404, i can use the ErrorDocument 404 command in htaccess to forward to the other domain, but when checking server headers, they are 302 redirects. Any way to make them 301?

  3. #3
    Join Date
    Nov 2003
    Location
    tampa, fl
    Posts
    326
    Netcheap, try this, it should work.

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^oldexample.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

  4. #4
    Thanks but that doesn't work.
    It forwards from oldexample.com, but not www.oldexample.com or any file names to the new domain.
    www.oldexample.com, www.oldexample.com/filehere.php, sub.oldexample.com do not forward.
    Only the non www main domain forwards to the new domain.

    I am looking to forward everything. Currently I'm using anErrorDocument 404 command line with the url after it and it works, but it's a 302 redirect in the server headers, and I need 301.

    Thanks

  5. #5
    Join Date
    Jun 2004
    Location
    Bay Area -USA
    Posts
    1,740
    you can use a simple 301 redirect.

    It's pretty easy just go like

    redirect 301 /forumdisplay.php http://newsite.com/

    put that in a .htaccess file
    <<< Please see Forum Guidelines for signature setup. >>>

  6. #6
    Join Date
    Jun 2004
    Location
    Bay Area -USA
    Posts
    1,740
    Opps forgot to post.
    Also put this in your .htaccess file.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^yoursite\.com
    RewriteRule (.*) http://www.yoursite.com/$1 [R=permanent,L]

    Hope that helps!
    <<< Please see Forum Guidelines for signature setup. >>>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •