| | 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! |
| Nov 8, 2009 |
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.
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)
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/');
Cpanel gives you options for permanent and temporary redirect. Check it out at your Cpanel.
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?
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.
Similar Topics
Keywords : htaccess, redirect, redirect, traffic, domain
(5) Hi, I am using the header function to redirect after the processing of the form. I have to specify Sub Domain Help in xampp (4) I am trying to work out how to get subdomains working in xampp. I have tried all of the tutorials (2) Well, I ran into a problem. I tried to make a code that matched everything, except strings (13) I am trying to make a login system that looks and works like .htaccess using sessions, with a PHP Help me out with this problem... (9) hey ppl, i just wanted a little help...i designed this website, but i want that if i click on redirect a page web to another page (7) Hi Is there some functions in php to redirect a page web to another page. thanks.... (2) I have a problem with the charset in my php page... firstly the whole site included .html and .php Looking for htaccess, redirect, redirect, traffic, domain
|
![]() .htaccess Redirect Question - redirect ALL traffic to another domain |
Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com