Status
Not open for further replies.

damoth

New Member
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
 

mneylon

Administrator
Staff member
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
 

ghost

New Member
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
 

damoth

New Member
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
 

damoth

New Member
Thanks for the help with this guys,

I've switched over to Linux hosting and have my redirects working now.
 
Status
Not open for further replies.
Top