Results 1 to 6 of 6
-
07-01-2005, 06:37 PM #1Junior Guru Wannabe
- Join Date
- Jul 2003
- Posts
- 37
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
-
07-02-2005, 02:38 AM #2Junior Guru Wannabe
- Join Date
- Jul 2003
- Posts
- 37
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?
-
07-02-2005, 03:15 AM #3Web Hosting Guru
- 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]
-
07-06-2005, 03:58 PM #4Junior Guru Wannabe
- Join Date
- Jul 2003
- Posts
- 37
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
-
07-06-2005, 04:41 PM #5Web Hosting Master
- 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. >>>
-
07-06-2005, 04:43 PM #6Web Hosting Master
- 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. >>>