473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fixing case-sensitive file errors? Mac Dev to Unix host

Hello. I do most of my web dev work from a Mac (whose file system is
case-insensitive.) I upload my web pages and other files onto a
Unix-based host, which is case sensitive.

When I look at the errors that were generated on my web site, I find
that sometimes people are trying to access, for example, "file.exe",
when I uploaded it as "File.exe" with an uppercase letter.

Some of these pages and files have had mixed case for years and years,
and 99% (I'm guessing) of requests are proper requests with mixed case.
I now realize it's often best to use all lower case for filenames to
prevent any confusion. (Too late for that, mostly.)

Anyway, my question is, is there any unix trick that I can use (I'm NOT
a power unix user obviously) to automatically point a user who is
looking for "file.exe" (which doesn't exist) to "File.exe" which DOES
exist? I'd like to do this trick to a number of files that have this
mixed case problem.

(With some extra work, I suppose I could post two files for each file I
really wanted. One with the original mixed case file name, and one with
the all lower case version. But, I'm not nuts about this solution as,
on my Mac, I will then no longer be able to store an exact copy of my
web site in a folder as I now can do, since the Mac won't let me store
two files with the same name with differing case in the same folder.)

Anyone know of a unix trick to point a request for an all lower case
file to a file that exists with the same exact name but different case?

Thanks!
Apr 11 '07 #1
7 3313
On 2007-04-11, Adam <ad**@smdopawmo a.comwrote:
Hello. I do most of my web dev work from a Mac (whose file system is
case-insensitive.) I upload my web pages and other files onto a
Unix-based host, which is case sensitive.

When I look at the errors that were generated on my web site, I find
that sometimes people are trying to access, for example, "file.exe",
when I uploaded it as "File.exe" with an uppercase letter.

Some of these pages and files have had mixed case for years and years,
and 99% (I'm guessing) of requests are proper requests with mixed case.
I now realize it's often best to use all lower case for filenames to
prevent any confusion. (Too late for that, mostly.)

Anyway, my question is, is there any unix trick that I can use (I'm NOT
a power unix user obviously) to automatically point a user who is
looking for "file.exe" (which doesn't exist) to "File.exe" which DOES
exist? I'd like to do this trick to a number of files that have this
mixed case problem.

(With some extra work, I suppose I could post two files for each file I
really wanted. One with the original mixed case file name, and one with
the all lower case version. But, I'm not nuts about this solution as,
on my Mac, I will then no longer be able to store an exact copy of my
web site in a folder as I now can do, since the Mac won't let me store
two files with the same name with differing case in the same folder.)

Anyone know of a unix trick to point a request for an all lower case
file to a file that exists with the same exact name but different case?
You could use symbolic links, I think you can configure Apache (assuming
that's what you're using) to follow symlinks when serving up files.

So you'd write a short script to symlink each file to a lowercase
version of itself, e.g. in Tcl:

foreach f [glob *.html] {
set l [string tolower $f]
if {![string equal $f $l]} {
exec ln -s $f $l
}
}

But why not just rename all the files on your local copy on the Mac once
and for all to have lower case everywhere, and then upload that?

I suppose people might have set up links and things to urls with mixed
case in your site and you don't want to break their links.

You could also try Apache's "mod_spelin g"

http://httpd.apache.org/docs/2.2/mod/mod_speling.html
Apr 11 '07 #2
Adam <ad**@smdopawmo a.comwrote:
Anyway, my question is, is there any unix trick that I can use (I'm NOT
a power unix user obviously) to automatically point a user who is
looking for "file.exe" (which doesn't exist) to "File.exe" which DOES
exist? I'd like to do this trick to a number of files that have this
mixed case problem.
The easiest thing is to do it the other way round. Fix your filenames and
then point anyone looking for "File.exe" to "file.exe". Just add this to
your Apache configuration:

rewriteEngine on
rewriteMap lowercase int:tolower
rewriteCond $1 [A-Z]
rewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L]

This is better than just ignoring the case because the 301 status code will
make sure search engines only store the lowercased version instead of
thinking you have a lot of similar pages differing only in the case of the
URLs.
Apr 13 '07 #3
Thanks to all (Ben, Duncan) for your great replies. Much appreciated.

But, I think BOTH of the solutions aren't applicable to me. I bounced
the first of the ideas off my web host provider (the mod_spelling) but
the response was that my site is hosted on a server that hosts many
other sites (no doubt, why it's relatively cheap!) and as such I can
NOT customize the server. I knew Unix had to have a sneaky way to fix
things, but it appears, so far, I can't use the great ideas presented.

Taking a related route, though...I'm learning about symbolic (soft)
links. Do you think this is a viable route to explore? The thing of it
is that I have a known finite number of affected files (say, 10). So, I
may have the occasional requests for up to 10 fixed named files that
are all in lower case. Can I create a symbolic link that "points" a
request for "file.exe" (which does NOT exist) into a request for
"File.exe", which does? I'm writing this before I check out exactly how
to create a symbolic link (like I said, Unix is not my forte), but I'm
hoping I can just fixedly create 10 symbolic links for the 10 known
files that have the mixed case problem and upload these symbolic links
like they were any other type of file to my web host.

Thanks again for your thoughts...

In article <Xn************ *************@1 27.0.0.1>, Duncan Booth
<du**********@i nvalid.invalidw rote:
Adam <ad**@smdopawmo a.comwrote:
Anyway, my question is, is there any unix trick that I can use (I'm NOT
a power unix user obviously) to automatically point a user who is
looking for "file.exe" (which doesn't exist) to "File.exe" which DOES
exist? I'd like to do this trick to a number of files that have this
mixed case problem.

The easiest thing is to do it the other way round. Fix your filenames and
then point anyone looking for "File.exe" to "file.exe". Just add this to
your Apache configuration:

rewriteEngine on
rewriteMap lowercase int:tolower
rewriteCond $1 [A-Z]
rewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L]

This is better than just ignoring the case because the 301 status code will
make sure search engines only store the lowercased version instead of
thinking you have a lot of similar pages differing only in the case of the
URLs.
Apr 14 '07 #4
Adam <ad**@smdopawmo a.comwrote:
Taking a related route, though...I'm learning about symbolic (soft)
links. Do you think this is a viable route to explore?
You might use it as a last resort, but it would be much better to create an
..htaccess file that configures proper redirect responses for the incorrect
URLs. Redirect responses don't create multiple URLs that must be treated as
distinct by browsers, caches, etc., even though they actually return the
same file.
--
Darin McGrew, mc****@stanford alumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp. com, http://www.HTMLHelp.com/

"How long is this Beta guy going to keep testing our stuff?"
Apr 14 '07 #5

Perfect! Exactly what I wanted. I looked up how to do a Redirect in an
..htaccess, tried it, works like a charm. THANKS!
In article <ev**********@b lue.rahul.net>, Darin McGrew
<mc****@stanfor dalumni.orgwrot e:
Adam <ad**@smdopawmo a.comwrote:
Taking a related route, though...I'm learning about symbolic (soft)
links. Do you think this is a viable route to explore?

You might use it as a last resort, but it would be much better to create an
.htaccess file that configures proper redirect responses for the incorrect
URLs. Redirect responses don't create multiple URLs that must be treated as
distinct by browsers, caches, etc., even though they actually return the
same file.
Apr 14 '07 #6
On 2007-04-14, Adam <ad**@smdopawmo a.comwrote:
Thanks to all (Ben, Duncan) for your great replies. Much appreciated.

But, I think BOTH of the solutions aren't applicable to me. I bounced
the first of the ideas off my web host provider (the mod_spelling) but
the response was that my site is hosted on a server that hosts many
other sites (no doubt, why it's relatively cheap!) and as such I can
NOT customize the server. I knew Unix had to have a sneaky way to fix
things, but it appears, so far, I can't use the great ideas presented.

Taking a related route, though...I'm learning about symbolic (soft)
links. Do you think this is a viable route to explore?
It also requires server configuration-- you need to tell the server to
follow symlinks. I don't think they usually do by default.

Your web host provider might have mentioned that you can do some server
configuration in the form of .htaccess files (that's what they're for),
since from your other post it appears you can. Given that you can use
..htaccess, Duncan's rewrite solution is better than the symlinks anyway.
Apr 14 '07 #7
Adam wrote:
Hello. I do most of my web dev work from a Mac (whose file system is
case-insensitive.) I upload my web pages and other files onto a
Unix-based host, which is case sensitive.

When I look at the errors that were generated on my web site, I find
that sometimes people are trying to access, for example, "file.exe",
when I uploaded it as "File.exe" with an uppercase letter.

Some of these pages and files have had mixed case for years and years,
and 99% (I'm guessing) of requests are proper requests with mixed case.
I now realize it's often best to use all lower case for filenames to
prevent any confusion. (Too late for that, mostly.)

Anyway, my question is, is there any unix trick that I can use (I'm NOT
a power unix user obviously) to automatically point a user who is
looking for "file.exe" (which doesn't exist) to "File.exe" which DOES
exist? I'd like to do this trick to a number of files that have this
mixed case problem.

(With some extra work, I suppose I could post two files for each file I
really wanted. One with the original mixed case file name, and one with
the all lower case version. But, I'm not nuts about this solution as,
on my Mac, I will then no longer be able to store an exact copy of my
web site in a folder as I now can do, since the Mac won't let me store
two files with the same name with differing case in the same folder.)

Anyone know of a unix trick to point a request for an all lower case
file to a file that exists with the same exact name but different case?

Thanks!
There is nothing really wrong with mixed-case file names. I do it all
the time. Go to my home page, scroll to the bottom, and select "Index
of HTML Files". You will see several files and even a few directories
with mixed-case names.

The problem is that, within your Web site, you must create links that
refer to all the files consistent with their mixed-case names. Thus, if
a file is "File.exe" (per your example), you must then use
<a href="File.exe" >
and not
<a href="file.exe" >

The use of soft links on your server will help. However, you should
consider that only a temporary solution until you correct your link
references. I use a soft link when I move a file from one directory to
another, to help visitors find the Web page at its old location. I then
warn those visitors that the page has moved and that they should update
their bookmarks. About 3 months later, I remove the soft link and the
warning.

--

David E. Ross
<http://www.rossde.com/>.

Anyone who thinks government owns a monopoly on inefficient, obstructive
bureaucracy has obviously never worked for a large corporation. © 1997
Apr 14 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3071
by: Andrew Ayre | last post by:
Hi, I have the following table layout: --------------------- | A | E | ------ |
115
7161
by: J | last post by:
I've run CSSCheck on my style sheets and I always get a warning similar to this: "font: bold 9pt/100% sans-serif Warning: Absolute length units should not generally be used on the Web ..." Yet if I use 'x-small' instead of 9pt, I get bigger type on IE6 and smaller type on Mozilla. My choices seem to be:
5
1911
by: Alicia | last post by:
Hello everyone based on the data, I created a union query which produces this. SELECT ,,, 0 As ClosedCount FROM UNION SELECT ,, 0 AS OpenedCount, FROM ORDER BY , ;
6
1945
by: Phillip N Rounds | last post by:
I have an application which is heavily graphics intensive, all the graphics being custom. Scattered throughout by app, I have MyView->OnDraw( this->GetDC() ); Apparently, each call to this->GetDC() creates a GDI object and, 16,000 or so calls to OnDraw() results in the Application hanging because it can no longer create any new GDI objects ( I know, 16,384 )
18
30476
by: chimalus | last post by:
I am using a table with no column widths specified, letting the table layout manager do its thing for figuring out the column widths, and this works just fine. Now I want to make the table dynamic. I have added a filtering mechanism (in javascript) that can be used to hide unneeded rows. However, each time I hide or show rows, the column sizes change, and this doesn't look good. Is there a way that I can preserve the column widths...
6
1486
by: Sambo | last post by:
Some time ago I bought a newer computer with W2000 already on it so I moved my old drive to it as secondary( python was installed on non primary partition ). Not sure if the .msi installers were broken before, but they are now (on this installation) and the reason I can't move to brand new installation is because I am missing sound drivers. I have copied 3 files from my d:\winnt\system32 (old C:) pywintypes24.dll, pythoncom24.dll (mod...
12
348
by: > Adrian | last post by:
How do I fix a form on the screen using VS C# 2005. By "fixing" I mean that the user cannot move the form about on the display. Thanks, Adrian.
0
1441
by: rossabri | last post by:
This topic has been addressed in limited detail in other threads: "sockets don't play nice with new style classes :(" May 14 2005. http://groups.google.com/group/comp.lang.python/browse_thread/thread/76d27388b0d286fa/c9849013e37c995b "Subclassing socket" Dec 20 2005 - Jan 14 2006. http://groups.google.com/group/comp.lang.python/browse_thread/thread/391728cd442339c8/c0581b9ee5e7ceaf Briefly, the socket module ("socket.py") provides a...
6
1886
by: mwhit74 | last post by:
here is the code: // CS 200 Lab 11 Problem 3 - phone.cpp // Test program for the keyToTones function. #include <iostream> using namespace::std; // Definition of the PhoneTones struct
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.