[Solved] 404 if no trailing slash

Added by Lexus45 11 months ago

Hello all.

I'm new to Lighttpd, and I faced a problem.

My Zabbix is in http://x.x.x.x/zabbix/ and everything works fine.
But if anybody tries to go to http://x.x.x.x/zabbix (no trailibg slash), he gets '404'.

I know that a trailing slash tells the webserver to search a directory, while no slash means to search a file. But as I thought, all servers go to directory if there's no file with such a name.

Is there any method to configure Lighttpd to open directory correctly even if there's no trailing slash in the address?

I'v searched this forum, found this but in fact it's not exactly what I need.

Thank you. =================

UPD: I have an i/ directory in document-root, and it opens well both as http:.../i/ and http:.../i

zabbix direcory is an alias:

alias.url = ( "/zabbix/" => "/usr/share/zabbix/" )

I think it's because of this. Do I need some regexp in my alias configuration?

UPD: I removed trailing slash in alias configuration and now it's OK :-) thanks.

alias.url = ( "/zabbix" => "/usr/share/zabbix/" )

Replies (1)

RE: [Solved] 404 if no trailing slash - Added by gstrauss 11 months ago

Yes, that is one workable solution (and the recommended solution for the common case).

Another alternative: if /zabbix-abc123 is also valid, then the original alias.url would be used and you can set up a mod_redirect rule to explicitly redirect from "/zabbix" to "/zabbix/"