301's are doing my head in !!!! help ...

Discussion in 'Search Engine Optimization' started by darrens, Feb 4, 2007.

  1. #1
    I have read tons of 301 redirect threads but i just can not get it to work how i want it too?

    I know its taking note of the .htaccess file because different code/301's i have added create different results.

    I have hundreds of pages on my site ... im closing it down in 6 months and trading on a different domain. What i want to do is make ANY visitors to my site get 301 redirected to within my old site so that they see a holding page explaining whats happening?

    So i want all files at www.mysite .com to redirect to index.php

    I have tried so many different ways and i get things like ...

    Visitor opens www.mysite .com/blue.php and it redirects to index.php but the url does not change?
    Another time i have added code and i get internal server errors.
    Another time it seems that its trying to redirect but it keeps loading the page?

    Man i need a drink.
     
    darrens, Feb 4, 2007 IP
  2. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #2
    
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 
    RewriteRule ^(.*)$ http://www.yournewsite.com/index.php [L,R=301] 
    
    Code (markup):
    Or if you want them to go to the same page on the new site:

    
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 
    RewriteRule ^(.*)$ http://www.yournewsite.com/$1 [L,R=301] 
    
    Code (markup):
     
    nevetS, Feb 4, 2007 IP
  3. drionix

    drionix Peon

    Messages:
    189
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hmm... but before setting-up the codes for .htaccess, have you tried to ask your host if the mod_rewrite module of Apache is Activated?
     
    drionix, Feb 5, 2007 IP
  4. darrens

    darrens Peon

    Messages:
    808
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,

    I have just tried the first section of code and this has no effect? i can still visit any pages on the site without it returning me to the home page?

     
    darrens, Feb 5, 2007 IP
  5. drionix

    drionix Peon

    Messages:
    189
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    As I have said before, have you tried asking your Systems Administrator if mod_rewrite module is activated for your server? Because if it is not, then none of the .htaccess code will work. :)
     
    drionix, Feb 5, 2007 IP
  6. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #6
    Just as a follow up, any directory in which you have a .htaccess file must have
    
    AllowOverride FileInfo
    
    Code (markup):
    at the very least in order to allow rewrites. Of course, mod_rewrite must also be installed, and the server must be apache. IIS Servers have their own version of mod_rewrite that's an ISAPI plugin but I have no idea what it is called.
     
    nevetS, Feb 6, 2007 IP