Jump to content
xisto Community
snlildude87

.htaccess Redirect Question redirect ALL traffic to another domain

Recommended Posts

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)

Share this post


Link to post
Share on other sites

Oh, you can also redirect access via PHP, using the header() function:

// Permanent redirect:header('HTTP/1.1 301 Moved Permanently', true);header('Location: http://forums.xisto.com/no_longer_exists/ 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://forums.xisto.com/no_longer_exists/;;

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.