IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

.htaccess Redirect Question

, redirect ALL traffic to another domain

snlildude87
no avatar
Moderator
***************
Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



Post #1 post Oct 5 2005, 01:07 AM
I want to redirect all my traffic from one site to another domain name. Is this possible, and if so, would I do something like this:

.htaccess code:
CODE
redirect 302 / http://www.mynewdomain.com


Thanks!
Go to the top of the page
+Quote Post
moldboy
no avatar
Privileged Member
*********
Group: Members
Posts: 516
Joined: 29-April 05
From: Canada Eh?!?
Member No.: 6,408



Post #2 post Oct 5 2005, 02:52 AM
Well, it seems to me that if you made your 404 error page so that it contined a javascript redirect that should do the trick.
Go to the top of the page
+Quote Post
Spectre
no avatar
Privileged Member
*********
Group: Members
Posts: 873
Joined: 30-July 04
Member No.: 246



Post #3 post Oct 5 2005, 03:34 AM
You have a couple of options, the simplest of which you have already mentioned (although I would recommend using a 301/permanent redirect over a 302/temporary equivalent). Note that you can use 'temp' or 'permanent' in place of the HTTP request codes.

Also try looking up the RewriteRule (or mod_rewrite)
Go to the top of the page
+Quote Post
Spectre
no avatar
Privileged Member
*********
Group: Members
Posts: 873
Joined: 30-July 04
Member No.: 246



Post #4 post Oct 5 2005, 03:37 AM
Oh, you can also redirect access via PHP, using the header() function:

CODE
// Permanent redirect:
header('HTTP/1.1 301 Moved Permanently', true);
header('Location: http://www.location.com/');
// Temporary redirect (note that sending the 'Location' header automatically sends a 302 redirect unless it is explicitly overwritten, as it is above):
header('Location: http://www.location.com/');
Go to the top of the page
+Quote Post
OpaQue
no avatar
Administrator
Group Icon
Group: Admin
Posts: 1,563
Joined: 11-June 04
From: Somewhere in Time & Space.
Member No.: 1
myCENT:10.74



Post #5 post Oct 5 2005, 06:52 AM
Cpanel gives you options for permanent and temporary redirect. Check it out at your Cpanel.
Go to the top of the page
+Quote Post
snlildude87
no avatar
Moderator
***************
Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



Post #6 post Oct 5 2005, 09:18 PM
So basically, I could do it my way (stated in the first post) or I could write put headers into the pages that I want redirected?

By the way, what's the difference between permanent and temporary? I mean, if you put it at permanent (301), then you can always edit the php file, right? Then isn't that temporary?
Go to the top of the page
+Quote Post
Spectre
no avatar
Privileged Member
*********
Group: Members
Posts: 873
Joined: 30-July 04
Member No.: 246



Post #7 post Oct 6 2005, 01:37 AM
The idea is that a temporary redirect indicates that the original page is going to be restored at some stage soon, and a permanent redirect means it's not coming back (or at least, won't be there for an extended period). For example, if you are doing site maitainance and don't want any of your pages viewed during the process, you might '302' them to, say, '/message.html' to inform them of this. But if you renamed your page from '/page.html' to '/otherpage.html', you might want to permanently redirect traffic from the former to the latter.

Most search engines also treat 301 and 302 redirection very differently. If you change your site to another domain name, then it is generally a good idea to use permanent redirects to point to your new domain name, informing the search engine that your site has been moved.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   15 chelcy 1,484 29th July 2004 - 12:46 AM
Last post by: football123213
No New Posts   5 juliagizzle 679 17th July 2004 - 02:22 PM
Last post by: OpaQue
No New Posts   7 andyy15 322 13th August 2004 - 06:10 PM
Last post by: odomike
No New Posts   10 outwarsecrets 938 9th August 2004 - 06:34 AM
Last post by: Spectre
No New Posts 9 CodeName_88 442 13th August 2004 - 10:19 PM
Last post by: annylei
No New Posts   5 KKI 186 13th August 2004 - 10:08 AM
Last post by: OpaQue
No New Posts   10 wassie 1,071 13th August 2004 - 09:25 PM
Last post by: wassie
No New Posts   6 sjc 418 27th October 2004 - 06:09 PM
Last post by: mohit-vohra
No New Posts   1 Mario 562 20th August 2004 - 12:29 AM
Last post by: ill
No New Posts   3 CuM2cmU 239 21st August 2004 - 03:56 PM
Last post by: OpaQue
No New Posts   1 eforumhongkong 510 21st August 2004 - 05:22 PM
Last post by: OpaQue
No New Posts   5 Zac 336 27th August 2004 - 11:00 PM
Last post by: Spectre
No New Posts   2 annylei 313 28th August 2004 - 09:13 PM
Last post by: OpaQue
No new   16 Triple X 851 25th September 2004 - 11:17 PM
Last post by: -prodigy-
No New Posts 8 spawn_syxx9 375 9th October 2004 - 07:46 PM
Last post by: Becca


 



RSS Lo-Fi Version Time is now: 5th December 2008 - 08:36 AM