www.webdeveloper.com
Results 1 to 2 of 2

Thread: .htaccess non www. and no index.htm

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    .htaccess non www. and no index.htm

    I have just created the website www.jamesdobb.co.uk and any non www. links are redirected along with any index.htm files. However google has just crawled the site and index the non www. version of it! I have shown the .htaccess file below, please help! Thanks!

    Code:
    RewriteEngine on
    RewriteBase / 
    
    ### re-direct any non-www. links / ###
    RewriteCond %{HTTP_HOST} ^acklinsbonefishlodge.com [NC]
    RewriteRule ^(.*)$ http://www.acklinsbonefishlodge.com/$1 [L,R=301]
    
    ### re-direct index.php to root / ###
    RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [L,R=301]

  2. #2
    Join Date
    Feb 2010
    Posts
    2
    Sorry wrong .htaccess file!

    Code:
    RewriteEngine on
    RewriteBase /
    ### re-direct any non-www. links / ###
    RewriteCond %{HTTP_HOST} ^jamesdobb.co.uk [NC]
    RewriteRule ^(.*)$ http://www.jamesdobb.co.uk/$1 [L,R=301]
    
    ### re-direct index.htm to root / ###
    RewriteCond %{THE_REQUEST} ^.*\/index\.htm\ HTTP/
    RewriteRule ^(.*)index\.htm$ /$1 [L,R=301]
    
    ### Allow .htm files to parse php ###
    AddHandler cgi-script .htm
    SetEnv PHP_EXTENSION .htm 
    ### AddType application/x-httpd-php .php .htm .html ###
    
    ## redirect and pages that can't be found ##
    ErrorDocument 404 /404-page-not-found.htm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles