| | 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! |
|
|
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.
Recent Queries:-
Keywords : htaccess redirect redirect traffic domain
Hi, I am using the header function to redirect after the processing of the form. I have to specify I am trying to work out how to get subdomains working in xampp. I have tried all of the tutorials Well, I ran into a problem. I tried to make a code that matched everything, except strings I am trying to make a login system that looks and works like .htaccess using sessions, with a PHP Hi Is there some functions in php to redirect a page web to another page. thanks... 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 |
| ADD REPLY / Got an Opinion! | Remove these ADs! | RAPID SEARCH! | Free Web Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|