Too long URLs in Apache

It turned out that in current version of Apache you're limited to 255 characters at most between each pair od slashes (after URL decoding is done). This short article discusses this issue and maybe useful to all developers, who are dealing with "beauty" (SEO-optimized) URLs, like for example URLs to blog posts containing entire title inside.

This is a rare situation (255 characters limit between slashes, not for the entire URL), but still worth exploring.

An example URL:

http://mysite.com/0,4050,,,1,10,-postDate,,,,,,tribeman+ds.+seller+%C5%BCy+us+%C5%82+ping+net+,,,
0,,,,155%24135%24152%24138%24153%24141%24159%24144%24139%24330%24149%24160%24150%24151%24142%2432
29%24147%24157%24148%24154%24327%24158%24328%24145%24136%24143,,,,120%24121%24123%24124%24122%233
4125%24126%24127%24128%24129%24130%24131%24186%24132,,,,,,,,,,,,,,,,,8%24153%24141%241,false.html

won't work in Apache and will cause it to throw 403 Access Denied error.

This comes from the fact that Apache maps each section (between slashes) to local filesystem and it hits its limitation here (255 characters at most per single level of directory tree).

There are a lot of ways to work around this problem, to name at first:

  • split too long part using additional slashes,
  • passing variables as GET parameters instead of slashes, etc.

Still, it is worth keeping above fact in mind.

Leave a Reply