UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 8th February 2008, 08:20 AM   #1 (permalink)
Lindyloo
Registered User
 
Join Date: Aug 2007
Posts: 9
Case sensitive would Mod rewrite help?

My old site (dating back to 1996) used to be on a windows server so it didn't matter if file names were upper or lower case.
Yes I know they should all have been lower case but on the mirror of the site on my hard drive they are all lower case so I have no idea how lots of files got indexed with a mix of upper and lower case as there does not seem to be any ryhme or reason to it.
Anyway, as the site has such longevity the search engines love it so I really do not want to lose the rankings.

Now the site is on its new home at UH but.... eeek! ........... thousands of 404 errors which is definately not good.
It seems Apache is very case sensitive where my old server was a windows server and not case sensitive.

I am a complete novice at mod rewrite stuff but I do already have my .htaccess file directing the 404 errors to my error page but, is there any way of using .htaccess to say "ignore what case the file is in, just give the people what they want"?

Any help would be really appreciated.
LL
Lindyloo is offline   Reply With Quote
Old 8th February 2008, 09:46 AM   #2 (permalink)
Simon
Dedicated to life!
 
Simon's Avatar
 
Join Date: Jul 2005
Posts: 2,099
I'm not 100% sure about this but it mighe be worth a go, but you'll need the help of support to enable it.

From the docs at mod_rewrite - Apache HTTP Server

rewritemap can only be used in server config files and not .htaccess

Code:
RewriteEngine On
RewriteMap lowercaseFileName txt:tolower 
RewriteRule (.*) ${lowercaseFileName:$1}
Be warned that this will convert every request to lowercase even if it is already so may increase server load..
__________________
Freelance PHP Programmer
__________________
Simon is offline   Reply With Quote
Old 8th February 2008, 10:54 AM   #3 (permalink)
Lindyloo
Registered User
 
Join Date: Aug 2007
Posts: 9
Hi Simon
Thanks for trying to help.
Trouble is that the site is heavily google & yahoo linked to files which are both upper & lower case plus lots of files in which have mixed upper & lower case.
Otherwise I would just do a global file & replace of all the files.

The site is static and it is now really just a high ranking hallway site that sends lots of customers to our database driven site, so I was hoping it would be an easy fix but, it looks like I'm in for a happy week or so of manually fixing it all

Ahh! well it will only be the pub and telly (and other nice things) I'll miss.
LL
Lindyloo is offline   Reply With Quote
Old 8th February 2008, 11:01 AM   #4 (permalink)
Simon
Dedicated to life!
 
Simon's Avatar
 
Join Date: Jul 2005
Posts: 2,099
as a temp fix I would probably write a small script that would replace your 404 page that would search for an alternative cased filename and use the php header function to redirect to the correct page and also set a 301 status
__________________
Freelance PHP Programmer
__________________

Last edited by Simon : 8th February 2008 at 02:21 PM. Reason: shoud have said 301 status not 302
Simon is offline   Reply With Quote
Old 8th February 2008, 01:08 PM   #5 (permalink)
Euge
Registered User
 
Euge's Avatar
 
Join Date: Feb 2003
Location: Lost in confusion
Posts: 710
Just a thought . . .

1) Test if there are any uppercase characters
2) Redirect request to a php script
3) Parses the original url to all lowercase
4) Redirect sending a 301 (permanent) status

Not sure if this is right, but the thought here is if you do a 301 redirect, the search engines will start indexing the all lowercase urls and you can eventually get rid of all redirects.

Otherwise, the search indexing won't change and you'll forever be using mod_rewrite on your site.
Euge is offline   Reply With Quote
Old 8th February 2008, 02:21 PM   #6 (permalink)
Simon
Dedicated to life!
 
Simon's Avatar
 
Join Date: Jul 2005
Posts: 2,099
Quote:
Originally Posted by Euge View Post
4) Redirect sending a 301 (permanent) status
I have corrected my previous post it should have said 301 not 302
__________________
Freelance PHP Programmer
__________________
Simon is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 11:29 AM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  SEO by vBSEO 3.0.0
Copyright © 1998-2009 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309