+ Reply to Thread
Results 1 to 10 of 10

Thread: non www domain redirect to www domain

  1. #1
    damoth is offline Frontpage User damoth will become famous soon enough
    Join Date
    Jul 2008
    Posts
    21

    Default non www domain redirect to www domain

    Hi,

    I'm new to all this and am just learning as i go...

    I'm setting up my first site which is www. portumna .net

    My domain is accessible through both http:// www. portumna .net and http:// portumna .net. It is appearing in google as both seperately under different search terms and the same thing seems to be happening in yahoo.

    I have been advised to do a 301 redirect from http:// portumna .net to http:// www. portumna .net to avoid any potential problems with search engine rankings.

    However, the site is using shared hosting on a windows server with the HELM control panel and i have been told i can't do the redirect i need to on this system. The support for the hosting company said all they could do is disable the non www domain so that only the correct one will be active.

    This sounds OK to me but i just wanted to check with people that have experience with this kind of thing..

    Thanks in advance.

    P.S. My site won't be completed for about another 4 weeks so i don't mind if i'm not in the rankings at all for a while. At the moment i just have a temporary homepage up so people will know i am working on it.

    damoth
    Last edited by damoth; 09-07-2008 at 07:26 PM.

  2. #2
    blacknight's Avatar
    blacknight is offline Web Slave blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    7,903

    Default

    I think someone posted some asp code for redirects on here a few days ago. I'd recommend you search the forum

    You can also specify the "preferred" domain in the Google webmaster console, which may help

  3. #3
    ghost's Avatar
    ghost is offline Wannabe Geek ghost will become famous soon enough
    Join Date
    Dec 2007
    Location
    Ennis
    Posts
    196

    Default

    what server side code are you using asp php ?

  4. #4
    ghost's Avatar
    ghost is offline Wannabe Geek ghost will become famous soon enough
    Join Date
    Dec 2007
    Location
    Ennis
    Posts
    196

    Default

    Hostname Redirect non-www to www
    This code should be inserted into a global include file or any script which is executed for every page on the site before the page output begins:

    For asp

    Code:
    <%
    If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
        Response.Status="301 Moved Permanently"
        Response.AddHeader "Location","http://www."
            & Request.ServerVariables("HTTP_HOST")
            & Request.ServerVariables("REQUEST_URI")
        Response.End
    End if
    %>
    
    For php

    Code:
    <?php
    if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
        header('HTTP/1.1 301 Moved Permanently'); 
        header('Location: http://www.'.$_SERVER['HTTP_HOST']
        .$_SERVER['REQUEST_URI']);
    }
    ?>
    
    Compliments of

    301 Redirects in Apache .htaccess, IIS, PHP, ASP and ColdFusion - Beyond Ink

  5. #5
    damoth is offline Frontpage User damoth will become famous soon enough
    Join Date
    Jul 2008
    Posts
    21

    Default

    Thanks guys but the site is just going to be HTML. It will all just be static web pages.

  6. #6
    ghost's Avatar
    ghost is offline Wannabe Geek ghost will become famous soon enough
    Join Date
    Dec 2007
    Location
    Ennis
    Posts
    196

    Default

    You are going to have your work cut out updating that lot.
    How many pages to start ?

  7. #7
    damoth is offline Frontpage User damoth will become famous soon enough
    Join Date
    Jul 2008
    Posts
    21

    Default

    There will a lot of pages. It's a community based site so i hope to have a news page for each club / group in the area... The idea being that they will email me their news and i will add it.

    Most pages will be mainly just text so one it's up and running, changes should just be added new text to pages already created.

    I'm also going to have a weekly general news page which will involve adding a new page to the site for each weeks news.

    I had considedered going with PHP but i only know the basics so it would take me extra time to learn that and i really need to have this finished in the next few weeks (which i am on track to do).

    I'm hoping to have some free time next year when i can go back and tidy up stuff and probably convert to a scripting language when the site is established in the area and everyone knows about it but i just dont have time for that now...

    What would you recommend to do for now with regards to the non-www & www domains?

    Thanks.

    damoth

  8. #8
    ghost's Avatar
    ghost is offline Wannabe Geek ghost will become famous soon enough
    Join Date
    Dec 2007
    Location
    Ennis
    Posts
    196

    Default

    Quote Originally Posted by damoth View Post
    What would you recommend to do for now with regards to the non-www & www domains?
    damoth
    Ask your host to switch you over to a linux system then you can use an htaccess file .

    Good luck with the site

  9. #9
    damoth is offline Frontpage User damoth will become famous soon enough
    Join Date
    Jul 2008
    Posts
    21

    Default

    OK, thanks..

  10. #10
    damoth is offline Frontpage User damoth will become famous soon enough
    Join Date
    Jul 2008
    Posts
    21

    Default

    Thanks for the help with this guys,

    I've switched over to Linux hosting and have my redirects working now.

+ Reply to Thread

Similar Threads

  1. Domain Parking Script with FREE. COM DOMAIN!
    By DomainZAar in forum Marketplace Offers
    Replies: 0
    Last Post: 12-05-2008, 10:27 AM
  2. New Domain name with 301 redirect
    By Wenlock in forum Search Engine Optimisation
    Replies: 6
    Last Post: 18-03-2008, 01:34 PM
  3. nonwww redirect to www domain on windows server
    By Vivid.ie in forum Coding Help
    Replies: 1
    Last Post: 04-12-2007, 05:35 PM
  4. Can you buy domain names with keywords and then redirect to you site?
    By Ecologikids in forum Search Engine Optimisation
    Replies: 9
    Last Post: 24-07-2006, 10:34 PM

Tags for this Thread

Posting Permissions

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

Search Engine Optimization by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64