canonical non WWW - 301 redirect

hi - need to do a 301 redirect. ISP servers is Windows so cannot create simple htaccesss file. Currently the non-www version of our website if showing a copy of our site and believe we are being penalised in SERPs.

I can get ISP to remove the non ww version so that error page comes up, but would like to set 301 redirect.

As windows based server think needs to be done in PHP. Any ideas of what the code would be and how i do it???

Any help appreciated!

Cheers

Potsy


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Google Is Your Friend.

header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$url);
header("Connection: close");

first hit on ‘php header 301’

Walter

On Feb 9, 2009, at 11:49 AM, Potsy wrote:

hi - need to do a 301 redirect. ISP servers is Windows so cannot
create simple htaccesss file.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

great, but how and where do i add this into freeway?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could put this in the Page / HTML Markup dialog, inside of `<?php ?

` delimiters. Be sure to put it in the very first slot – Before
HTML – so that it runs before any other code is sent. A simpler way
to do it would be to put the following in a plain text file (use a
real editor, like TextWrangler or Textmate or BBEdit) and save it as
index.php. Any page you add this to will need to have its filename
changed from filename.html to filename.php. You do this in the page
Inspector in Freeway.

Note that this is not going to redirect any “deep” links (links to an
actual page filename) because you aren’t using an .htaccess redirect.
Any pages that you change from HTML to PHP in order to use this trick
will simply 404 of someone visits from a bookmark or a Google index
hit, because the old page will truly be gone.

You should definitely talk to your hosting provider about setting up a
permanent full-domain redirect at the server level. Even though you
are mired in IIS-land, there are still a few things that your host can
do for you, and this is one of them. Longer-term, you should see about
moving to a more standard host, as that will have all manner of
additional benefits, not the least of which will be lower long-term
cost and better sleep at night.

Walter

On Feb 9, 2009, at 12:19 PM, Potsy wrote:

great, but how and where do i add this into freeway?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry, forgot the “following” part!

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://yournewdomain.com/index.html");
header("Connection: close");
?>

It occurs to me that you might be able to do an end-run around this
problem if you have control over the DNS settings for this domain
name. Simply change the DNS to point the old domain at a cheap Unix
hosting account somewhere, then set up a proper full domain redirect
there with .htaccess:

Redirect Permanent   /   http://yournewdomain.com/

That will take any page request into that domain and send it on to the
new host.

Walter

On Feb 9, 2009, at 1:13 PM, Walter Lee Davis wrote:

A simpler way to do it would be to put the following in a plain text
file (use a real editor, like TextWrangler or Textmate or BBEdit)
and save it as index.php.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

thanks for all your help.

think i will speak to Nildram about moving to Unix / Apache server is this going to be better with freeway? will it mean that forms etc and existing site will work as currently or will they need recoding??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

In my opinion, using a Windows Web server is a giant bag of pain,
compared with Unix or Linux. That said, there are settings in which it
is impossible to use anything else. But for most cases, you will find
that the server tools work better on *nix, there are more options
available to you with respect to back-end trickery, it’s easier to get
help, etc. The entire core of the Internet runs on Unix and Linux, and
it got that way because only the fittest survive.

If your current site has forms that use ASP or .NET for their
processing, then you won’t be able to port them (easily) except by
installing a third-party shim layer or by re-writing them. If your
forms use standard Perl CGI, then they should be directly portable.
And if they use PHP, then they should also work, provided you rip out
any hacking that might have been added to force PHP to work in a
Windows environment.

Walter

On Feb 11, 2009, at 9:40 AM, Potsy wrote:

think i will speak to Nildram about moving to Unix / Apache server
is this going to be better with freeway? will it mean that forms etc
and existing site will work as currently or will they need recoding??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for all your help! I have now moved our website www.batchelor-electrical.co.uk across to Unix server from Windows with ISP and added .htaccess file with following code, but not redirecting non-www version, just Nildram holding page - any ideas? It is stored in the same root level folder as the site home page etc.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^batchelor-electrical.co.uk [NC]
RewriteRule ^(.*)$ http://www.batchelor-eletrical.co.uk/$1 [L,R=301]

On another note forms are PERL do I just have to redirect to new server as currently not working.

any help appreciated.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Make sure that your DNS is set up properly. A CNAME for the www, and
an A record for the domain itself, pointing back to the CNAME. Also
check that Apache has the ServerAlias property set in its
configuration file. This will be handled from your control panel (if
you’re lucky) or by filing a support ticket with your hosting
providers’ help desk.

Walter

On Feb 24, 2009, at 11:35 AM, Potsy wrote:

ust Nildram holding page - any ideas? It is stored in the same root
level folder as the site home page etc.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

thanks Walter - will log ticket…again!!!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options