1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

correct 301 coding

Discussion in 'Apache' started by leeds1, Jan 15, 2005.

  1. #1
    Can some confirm the correct way to 301 redirect stuff:


    Scenario1
    ----------
    redirect domain.com to www.domain.com

    Is it:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain\.co.uk
    RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=permanent,L]
    
    Code (markup):

    Scenario2
    -----------
    redirect www.domain.com to www.domain.co.uk

    Is it:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=permanent,L]
    
    Code (markup):


    does the R=permanent need to be R=301?

    For my error documents I have simple code as :

    ErrorDocument 401 http://www.domain.co.uk/401.shtml

    Will google recognise the 301 code ?

    thanks
     
    leeds1, Jan 15, 2005 IP
  2. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
    #2
    Here is what is working for me:
        RewriteEngine on
        RewriteCond %{HTTP_HOST}                !^www.internet-search-engines-faq.com(:80)?$
        RewriteRule ^/(.*)                      http://www.internet-search-engines-faq.com/$1 [L,R=301]
    
    Code (markup):
     
    Will.Spencer, Jan 15, 2005 IP