hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : 301 redirect in htaccess question
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

301 redirect in htaccess question

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-01-2005, 06:37 PM
netcheap.com netcheap.com is offline
Junior 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

Reply With Quote


Sponsored Links
  #2  
Old 07-02-2005, 02:38 AM
netcheap.com netcheap.com is offline
Junior 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?

Reply With Quote
  #3  
Old 07-02-2005, 03:15 AM
recipher recipher is offline
Web 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]

__________________
Underground Art | Experimental Music

Reply With Quote
Sponsored Links
  #4  
Old 07-06-2005, 03:58 PM
netcheap.com netcheap.com is offline
Junior 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

Reply With Quote
  #5  
Old 07-06-2005, 04:41 PM
VolkNet VolkNet is offline
Web Hosting Master
 
Join Date: Jun 2004
Location: Bay Area -USA
Posts: 1,738
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. >>>

Reply With Quote
  #6  
Old 07-06-2005, 04:43 PM
VolkNet VolkNet is offline
Web Hosting Master
 
Join Date: Jun 2004
Location: Bay Area -USA
Posts: 1,738
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. >>>

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Joomla Hosting Study Shows Speed, Uptime Top Selling Points of a Web Host Web Hosting News 2012-11-07 15:06:36
Rackspace Blog Looks at Easy Outsourcing for App Development Blog 2012-03-05 19:07:48
Officials Arrest Six Estonians in DNSChanger Cybercrime Bust Web Hosting News 2011-11-10 21:52:48
Blackberry the UnCloud Blog 2011-10-14 15:28:54
Go Daddy Helping Customers Repair Compromised Sites Web Hosting News 2011-09-16 14:35:03


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?