Ah I see I foolishly double posted - on the other post Jonathan Riddle kindly pointed me to an explanation and some code to solve the problem … very good thank you Jonathan … however can someone explain how I add this to the ‘site’ in Freeway is it ‘insert’ ‘markup item’ ? … and, as a matter of course, should I add it to all my other sites ?
You have indeed double posted - but not to worry - it happens! I will respond further on this thread as that is where you have asked another question.
As David states, most search engines will tend to suss out which is preferred, especially if you register your site with Google Analytics and following their instructions for submitting a sitemap.xml file. I have a few sites online, and I haven’t had to specifically solve this problem because Google has worked it out for itself on all but one page - helped in all cases by sitemap.xml files.
However, doing the Google search as suggested in the link I gave on the other thread indicates your site is being indexed with and without www, so I would personally advise you create the necessary 301 redirect.
Although I am far from experienced in such things (as David will know!), I create mine in either a simple text editor or BBEdit. Following the instructions on that link I gave you, you will actually generate simple text files with the redirect coding on it, and save it with a name of .htaccess, and then upload that file separately via an ftp application such as CyberDuck, making sure it sits in the same folder as the index.html file. However, you may already have .htaccess files on your server, so be careful as you can only have one in each folder.
However, because files with a fullpoint in front of them are invisible to the system, I just save the file with the name htaccess (minus the fullpoint), upload that to the appropriate server via ftp, and then rename that file actually on the server by adding a fullpoint in front.
By the way, I can wholeheartedly recommend the hosting David provides, because it provides many and varied automated ways of doing things such as this.
You will find it impossible to save a file on your Mac with a leading
dot in the filename, unless you are using a programmer’s text editor
like BBEdit, TextWrangler, TextMate, etc. The Finder doesn’t let you
save a file with a leading dot, because that will make the file
invisible.
So to save yourself some heartache, save the file as htaccess.txt on
your Mac, set your FTP application to “Show Hidden Files”, and then
look in your server’s site root directory. See if there is an
existing .htaccess file there (you may see a whole shed-load of hidden
files, some hosting providers love to put the entire control panel and
log analysis software in your site root and just hide it from normal
view).
If you do see an .htaccess file already in your server’s directory,
click on it once and use your FTP application’s “Edit with…” command
to open it directly in your text editor. See if it already defines a
bunch of redirects or security realms or what have you. If it does,
then add your redirect directive to the end of that file, save it, and
test your server immediately. IF this addition causes pain, then
delete it and save again, and file a support ticket with your hosting
provider explaining what you need to do and asking them why your
server isn’t behaving.
Walter
On Jan 19, 2011, at 7:16 AM, Jonathan Riddle wrote:
and save it with a name of .htaccess, and then upload that file
separately via an ftp application such as CyberDuck, making sure it
sits in the same folder as the index.html file. However, you may
already have .htaccess files on your server, so be careful as you
can only have one in each folder.
I did try and cover that Walter, but of course you explained it far better, with the important addition of how to check if you have any invisible files on the server already.
I do it the way I described because it does mean you always have a copy on your Mac which you can quickly re-upload if things go wrong.
In any case, I would certainly make sure you copy any existing .htaccess files onto your Mac into a folder (they will of course be invisible, so call the folder something logical), and then open those files from within BBedit by going to File>Open Hidden…
This way, you can then save a duplicate of the file, but without the fullpoint if you wish!
However, because files with a fullpoint in front of them are invisible to the system, I just save the file with the name htaccess (minus the fullpoint), upload that to the appropriate server via ftp, and then rename that file actually on the server by adding a fullpoint in front.
Forgot to add – once you move it to your server, you can rename it
as .htaccess, but then only if you have Show Hidden Files on –
otherwise, you’ll rename it, and it will promptly disappear from the
list of files.
Walter
On Jan 19, 2011, at 8:27 AM, Walter Lee Davis wrote:
So to save yourself some heartache, save the file as htaccess.txt on
your Mac
Thanks again chaps for an enormous amount of help and advice which I will work my way through, - is it easy to explain how I got into this predicament, I’d just like to avoid it happening again ?
I’ve also just spotted that Jonathan suggests David’s hosting, well I do get my hosting from David so I’ll check that out … maybe David can give me a hint ! - Roger
I normally create .htaccess directly on the server using Transmit (FTP client). Or you could use the file manager (browser FTP) in the hosting panel which will also create/show/edit any .htaccess files for you if you haven’t got a FTP client to hand.
David Owen { Freeway Friendly Web hosting and Domains }
I’ve also just spotted that Jonathan suggests David’s hosting, well I do get my hosting from David so I’ll check that out … maybe David can give me a hint ! - Roger
I’m still struggling with this redirect business. I DID find a hidden .htaccess on my server. (Found it using Transmit.) It has some stuff in it, none of which I understand and have no intention of changing.
I don’t understand precisely what I should write to make that happen.
I’m sorry if I just don’t understand this from the thread here, and would appreciate exactly what it is I should add to that existing file on the server.
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
AuthName whitehallboca.com
AuthUserFile /var/www/vhosts/whitehallboca.com/httpdocs/_vti_pvt/service.pwd
AuthGroupFile /var/www/vhosts/whitehallboca.com/httpdocs/_vti_pvt/service.grp
Go through that code, and replace example.com with your own hostname.
Save the file (which should upload it automatically if you’re using Transmit) and try your browser. If you get a 500 error, delete that code from .htaccess and save. Then file a help desk ticket with your hosting provider, and tell them you need ModRewrite on your server, as well as AllowOverrides=all. One of those two will be the issue.
Thanks, Walter. And one more question, if I may. I recently added an xml sitemap to the root level of my domain. Assuming all goes well with the htpaccess file, should I then update that xml sitemap, too?
In fact, is that something that should be updated every time I add or remove a page from the site? I do pretty fine within Freeway, but get really nervous about having to go outside of it and into the belly of the beast.
The .htaccess file is categorically not a part of your site. Your
Apache configuration files make it impossible for anyone to navigate
to it or download it by any public (non-password) means. So when you
change your .htaccess file, the content of your xml index should not
be affected.
What you might need to do is look through there and see if there’s any
part where they define the hostname of your server, and if they call
it example.com rather than www.example.com, you should change that.
But the rest of your pages should be fine. I believe all of the URLs
inside an index xml file are relative, not absolute.
Walter
On Feb 25, 2011, at 10:25 AM, LauraB wrote:
Thanks, Walter. And one more question, if I may. I recently added an
xml sitemap to the root level of my domain. Assuming all goes well
with the htpaccess file, should I then update that xml sitemap, too?
In fact, is that something that should be updated every time I add
or remove a page from the site? I do pretty fine within Freeway, but
get really nervous about having to go outside of it and into the
belly of the beast.