Apache2 Case Insensitive

We are running Apache2 2.2 on openSuSE 12.2 and have created an alias called “BAMWeb”, that points to a directory. We do not want users to worry about the capitalization and want the alias to be case insensitive. I found post about a module called mod_speling. I loaded the module and verified that it was loaded using the “apache2ctl -M” command:

.
.
.
setenvif_module (shared)
ssl_module (shared)
userdir_module (shared)
php5_module (shared)
reqtimeout_module (shared)
speling_module (shared)
mono_module (shared)
Syntax OK

It also said to define a Directive:

CheckSpelling on

I tried to put it in the following context in the httpd.conf file:

< Directory />
CheckSpelling on
Options None
AllowOverride None
Order deny,allow
Deny from all
< /Directory>

Restarted apache2 (service apache2 restart)

But I still must capaitalize the location. It is <fqdn>/BAMWeb. I am trying to be able to access it by using <fqdn/bamweb> or <fqdn>/Bamweb, etc…

I also put it in the default-server.conf file within the DocuementRoot context, restarted, but still no change.

I am sure it is a missed step that I am not seeing. other than loading the module, is there anything else I should have accomplished? Or point me in the right direction?

Thanks,
Keith

On 02/15/2013 02:56 PM, keithouellette wrote:
> We are running Apache2 2.2 on openSuSE 12.2 and have created an alias
> called “BAMWeb”, that points to a directory. We do not want users to
> worry about the capitalization and want the alias to be case
> insensitive.

so, instead of naming it BAMWeb, why not just name it bamweb?

or,maybe make another directory named /bamweb and link (or forward)
it to /BAMWeb


dd
http://tinyurl.com/DD-Caveat

I thought of that, but BAM is an acronym that users know and may capitalize only that part or all of it or as it is defined. The goal is to get users where they need to be as long as they use the correct letters in the correct order, but ignore the case. I thought that is possible with the mod_speling module. Is that not the case?

Keith

Personal opinion alert:

URLs should be lower case, and I think most users type them in lower case
these days. The user of upper-case is semi-accepted in the non-techy
world on billboards or other places where the domain name (only) is in
CamelCase so that the words within the domain name can be more-easily
identified by mere mortals, but in the end that works because DNS is, by
RFC, case-insensitive. URLs outside of the domain portion, though, are
like anything else in a computer: case-sensitive.

As a result, train your users. Worst case setup /bamweb and then if
complaints really come in with enough justification to change things then
add a symlink from the sites that fail. You can even trivially be
proactive by watching your /var/log/apache2/error_log file for 404s with
‘bamweb’ (case-insensitive) in them. Chances are good that one of the
following will happen within about a day of the first time people login:

  1. They’ll type it lower-case just because they’re lazy an that’s the
    web’s norm.
  2. They’ll bookmark it explicitly.
  3. Their browser will remember it for them because browsers have moved to
    that level for several years now.
  4. One person will complain; (s)he will be an English professor insistent
    that abbreviations or acronyms be capitalized, and furthermore will insist
    that there be periods between the letters to indicate they are
    abbreviating something else. This person should be fired.

Good luck.

On 02/15/2013 03:26 PM, keithouellette wrote:
> Is that not the case?

it claims to be the case…i’ve never tried it (if i name a directory
/BaM i expect for myself and all who want entry to have to use /BaM
(exactly)…because i know next decade i might also want to have a
/Bam, /bam, /bAm, /baM and others…

but if the module isn’t working for you then either you have set it
up wrongly or you have discovered a bug…i don’t have the expertise
to tell which, sorry…

hopefully a apache guru happens by eventually…there might be one
here today or tomorrow…


dd

keithouellette wrote:
> We are running Apache2 2.2 on openSuSE 12.2 and have created an alias
> called “BAMWeb”, that points to a directory. We do not want users to
> worry about the capitalization and want the alias to be case
> insensitive. I found post about a module called mod_speling. I loaded
> the module and verified that it was loaded using the “apache2ctl -M”
> command:
>
>
> …
> …
> …
> setenvif_module (shared)
> ssl_module (shared)
> userdir_module (shared)
> php5_module (shared)
> reqtimeout_module (shared)
> speling_module (shared)
> mono_module (shared)
> Syntax OK
>
>
> It also said to define a Directive:
>
> CheckSpelling on
>
>
>
> I tried to put it in the following context in the httpd.conf file:
>
> < Directory />
> CheckSpelling on
> Options None
> AllowOverride None
> Order deny,allow
> Deny from all
> < /Directory>
>
> Restarted apache2 (service apache2 restart)
>
> But I still must capaitalize the location. It is <fqdn>/BAMWeb. I am
> trying to be able to access it by using <fqdn/bamweb> or <fqdn>/Bamweb,
> etc…
>
> I also put it in the default-server.conf file within the DocuementRoot
> context, restarted, but still no change.
>
> I am sure it is a missed step that I am not seeing. other than loading
> the module, is there anything else I should have accomplished? Or point
> me in the right direction?

I hadn’t heard about CheckSpelling before, so thanks for the pointer :slight_smile:

I think you’ve got the principles right, so you must have made a
typo-type mistake. I can’t tell what because you’ve extracted text
instead of posting actual output. For example, where the asterisks
really around the output from apache2ctl? (if so, I have no idea what
they mean) What was the name of the directory to which you applied the
directive? (if it was really “/” then (a) I think it may need quotes and
(b) that seems a poor choice; I’d think something more like
“/srv/www/htdocs” would be reasonable)

My other thought is to check the apache log and see if it’s logged an
error with the directive. Or up the log level and see how your requests
are being processed. Failing that, try an apache-specific forum rather
than an opensuse one.

HTH, Dave

Dave,

Thank you for your response. I believe the asterisk you see are the “bold” tags when I bolded the line in the post to draw attention to that line. It was not in the output. the output was:

test-web2:/home/netadmin # apache2ctl -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_default_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
include_module (shared)
log_config_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)
ssl_module (shared)
userdir_module (shared)
php5_module (shared)
reqtimeout_module (shared)
speling_module (shared)
mono_module (shared)
Syntax OK

I did try it at the “/srv/www/htdocs”. In the version of openSuSE (12.2) and Apache2 (2.2) that is defined in the /etc/apache2/default-server.conf file. When adding it there, it looked like:

test-web2:/home/netadmin # cat /etc/apache2/default-server.conf

Global configuration that will be applicable for all virtual hosts, unless

deleted here, or overriden elswhere.

DocumentRoot “/srv/www/htdocs”

Configure the DocumentRoot

<Directory “/srv/www/htdocs”>
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that “MultiViews” must be named explicitly — “Options All”
# doesn’t give it to you.
#
# The Options directive is both complicated and important. Please see
# core - Apache HTTP Server
# for more information.
CheckSpelling on
Options None
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride None
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>

Aliases: aliases can be added as needed (with no limit). The format is

Alias fakename realname

Note that if you include a trailing / on fakename then the server will

require it to be present in the URL. So “/icons” isn’t aliased in this

example, only “/icons/”. If the fakename is slash-terminated, then the

realname must also be slash terminated, and if the fakename omits the

trailing slash, the realname must also omit it.

We include the /icons/ alias for FancyIndexed directory listings. If you

do not use FancyIndexing, you may comment this out.

Alias /icons/ “/usr/share/apache2/icons/”
<Directory “/usr/share/apache2/icons”>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ScriptAlias: This controls which directories contain server scripts.

ScriptAliases are essentially the same as Aliases, except that

documents in the realname directory are treated as applications and

run by the server when requested rather than as documents sent to the client.

The same rules about trailing “/” apply to ScriptAlias directives as to

Alias.

ScriptAlias /cgi-bin/ “/srv/www/cgi-bin/”

“/srv/www/cgi-bin” should be changed to whatever your ScriptAliased

CGI directory exists, if you have that configured.

<Directory “/srv/www/cgi-bin”>
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>

UserDir: The name of the directory that is appended onto a user’s home

directory if a ~user request is received.

To disable it, simply remove userdir from the list of modules in APACHE_MODULES

in /etc/sysconfig/apache2.

<IfModule mod_userdir.c>
# Note that the name of the user directory (“public_html”) cannot simply be
# changed here, since it is a compile time setting. The apache package
# would have to be rebuilt. You could work around by deleting
# /usr/sbin/suexec, but then all scripts from the directories would be
# executed with the UID of the webserver.
UserDir public_html
# The actual configuration of the directory is in
# /etc/apache2/mod_userdir.conf.
Include /etc/apache2/mod_userdir.conf
# You can, however, change the ~ if you find it awkward, by mapping e.g.
# Example Domain → /home/karl-heinz/public_html/
#AliasMatch ^/users/([a-zA-Z0-9-_.])/?(.) /home/$1/public_html/$2
</IfModule>

Include all *.conf files from /etc/apache2/conf.d/.

This is mostly meant as a place for other RPM packages to drop in their

configuration snippet.

You can comment this out here if you want those bits include only in a

certain virtual host, but not here.

Include /etc/apache2/conf.d/*.conf

The manual… if it is installed (’?’ means it won’t complain)

Include /etc/apache2/conf.d/apache2-manual?conf

I am realatively new to openSuSE, so I would not be surprised if there is an option that is keeping it from working. Thank you for your response.

Keith

Ok, so in trying to figure this out more. I found out a few things. First we are using mono to run a .net application. In the httpd.conf file I posted earlier (the complete one), it shows the following:

AddMonoApplications default “/BAMWeb:/srv/www/htdocs/”
<Location /BAMWeb>
SetHandler mono
</Location>

The “/BAMWeb” is what we are trying to get case insensitive. I starting focusing on mono and found a setting called MONO_IOMAP that can be set. Although I set it in the httpd.conf it does not allow me to put in /bamweb or /bamweb. However it looks like actual files or directories become insensitive as I can enter Default.aspx or DEFAULT.ASPX or default.aspx as the index page. So it appears to be mono related.

I just figured I would provide the latest on this issue. Thank you for your time in responding so far.

Thanks,
Keith

keithouellette wrote:
> I just figured I would provide the latest on this issue. Thank you for
> your time in responding so far.

I can’t help directly - I don’t know anything about mono. At this point,
I would definitely look in the logs and increase the logging level to
see how the requests are being handled.

Dave Howorth wrote:
> keithouellette wrote:
>> I just figured I would provide the latest on this issue. Thank you for
>> your time in responding so far.
>
> I can’t help directly - I don’t know anything about mono. At this point,
> I would definitely look in the logs and increase the logging level to
> see how the requests are being handled.

Oh, and mod_rewrite might be a magic wand if you can’t see any other way
out of the pit …