Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A weird request, but I really need this answered. Can you guys help me using re-write rules to remove the trailing slash from urls in Lighttpd.conf?

EG:

**A** www.example.com/page/
**B** www.example.com/page

I want url A to be forced into the semantics of url B.

Thank you very much.

share|improve this question

2 Answers 2

What you are trying to do sounds wrong. The web-server does not handle the request urls that the browser sees. This is an application issue. Your web-application needs to present the urls in the form of www.example.com/page instead of www.example.com/page/ that it does now.

If you do not want to change the application but still want this desired behaviour, you may want to consider using a filtering proxy in front of lighty and then filtering all the returned links.

share|improve this answer

Not really to the point, but you might want to have the reverse effect...

Anyways, as far as lighttpd code goes, that would be something like this:

url.redirect = ( "/page/" => "/page" )
url.rewrite-once = ( "/page" => "/page/" )

but, since "/page" doesn't find a file and tries the directory "/page/" (and the rewrite seems to do nothing to hide that), that does produce a redirect-loop.

Then your real question would be: is it possible to tell lighttpd not to redirect on directories? That, unfortunately, I didn't find a way to do... but I didn't search in deep, in fact I do prefer URLs with trailing slashes (also visually)...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.