how do I get automatic content negotiation?

#1
How do I get LiteSpeed to do content negotiation like Apache did? My webhost provider was bought out and replaced Apache with LiteSpeed and regularly stuffs up my entire website in different ways. I write HTML from scratch, I do not use blogging software.

Previously mod_negotiation handled this kind of thing brilliantly:

Requesting a URI like "www.example.com/test" would automatically load a "test.html" file in the server root, if it exists. Or a "test.php" file, if it exists. Or a "test.shtml" file, if it exists. Or the default page in a "test" directory, if there was a "test" directory. Or list the contents in the "test" directory if there was one, and it didn't have a default page to serve in it.

I don't mean a case of choosing this or that, with some kind of priority, out of a list of things if all or some of them existed. I just want that clean URI to load the one thing that actually exists on the website.

Today I may create a flat "test.html" file, tomorrow I might replace it with a "test.shtml" file that had more features, or a "test.php" file with even more abilities. Later I may replace that one file with a "test" named directory full of detailed individual pages on the topic. And I want the links to that file to always be the same address (e.g. "www.example.com/test"), and likewise with all the other un-suffixed URLs I'll use.

If my site contains files such as

/contact.html
/info.html
/miscellaneous.html

Then I expect any link to "/contact" to load that "contact.html" page, a link to "/info" to load "info.html" etc., without a mass of special rules for each one.

And, yes, I have these options set in a .htaccess file

Options +Multiviews
MultiviewsMatch Any

Previously I didn't have the "MultiviewsMatch Any" setting, but I tried adding it today and it makes no difference.

But it all LiteSpeed manages to do is load a "test.html" file if it exists, no other kind of file. And even that fails at times, some links will work, some won't. Likewise with it sometimes will load a directory, other times I'm forced to append a slash onto the URL (and it makes little difference whether that directory has a default page, or will be a listing of the contents).

LiteSpeed is supposed to be a "drop-in" replacement for Apache, but is missing that necessary feature that Apache has had for decades.
 
Last edited:

abk

Administrator
Staff member
#2
LiteSpeed Web Server doesn't support content negotiation via mod_negotiation, I would recommend you check if you can achieve what you intend by using rewrite rules.
 
#3
Seriously??? If it cannot do the basic functions that Apache has done for decades, then LiteSpeed is NOT a drop-in replacement for Apache.

And *exactly* how am I supposed to do *this* with re-write rules? I see *no* useful documentation for doing that in LiteSpeed, anywhere. I've already found out that it it doesn't have the same rewrite ruleset as Apache, so I can't follow their instructions.

I'm certainly not going to re-code an entire website to suite LiteSpeed's shortcomings, as someone else suggested in a direct reply. I'll be ditching the mickey mouse server for a real one
 
#4
Seriously??? If it cannot do the basic functions that Apache has done for decades, then LiteSpeed is NOT a drop-in replacement for Apache.

And *exactly* how am I supposed to do *this* with re-write rules? I see *no* useful documentation for doing that in LiteSpeed, anywhere. I've already found out that it it doesn't have the same rewrite ruleset as Apache, so I can't follow their instructions.

I'm certainly not going to re-code an entire website to suite LiteSpeed's shortcomings, as someone else suggested in a direct reply. I'll be ditching the mickey mouse server for a real one
You are right, I agree with you on that.
 
#5
You are right, I agree with you on that.
This was my crude hack to fake it, and it needs to be said that it doesn't actually do "content-negotiation," it's just an automated list of alternatives to suit my particular issue. It will suit my needs, in this instance, but not anybody who needs proper content negotation (such as which language page to serve, which kind of graphic or video format is best and mutually compatible, etc). I have no idea how efficient it is, and I don't care. Not my problem... It's a lot of messing around as opposed to just typing "Options +Multiviews"


## a .htaccess (for the whole site) hack to very badly fake mod_negotiation:
## requests for domainname/path/name (that "name" is any directory name or filename without any .suffix)
## this will try to load directory called name, or file name.html, or name.shtml, or name.php
## to further the list, look at the last two lines as a template for what to do for your own variations

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [L]
RewriteCond %{REQUEST_FILENAME}.shtml -f
RewriteRule ^(.*)$ $1.shtml [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
 
Top