Sensible URLs with PHP
4th October 2002
Brent Simmon’s Law of CMS URLs:
The more expensive the CMS, the crappier the URLs.
The article includes an interesting comments thread discussing human readable URLs and why so many high end content management systems just don’t bother with them. There are a couple of interesting links as well: User-Centered URL Design and a useful description of how Vignette StoryServer URLs are structured.
I am a big fan of logical URLs (as can be seen on this site)—the combination of PHP and Apache makes it easy to have all requests to a specific sub-directory of a site handled by a single script. Here’s the .htaccess
file for the root directory of my blog:
<Files archive> ForceType application/x-httpd-php </Files> <Files categories> ForceType application/x-httpd-php </Files> <Files contact> ForceType application/x-httpd-php </Files> <Files syndicate> ForceType application/x-httpd-php </Files>
The following PHP code (or a variation of it) is then used to break the requested URL up in to an array which can then be processed to decide what content to serve the user:
$path = $_SERVER['REQUEST_URI']; $bits = explode('/', $path);
More recent articles
- Weeknotes: Llama 3, AI for Data Journalism, llm-evals and datasette-secrets - 23rd April 2024
- Options for accessing Llama 3 from the terminal using LLM - 22nd April 2024
- AI for Data Journalism: demonstrating what we can do with this stuff right now - 17th April 2024
- Three major LLM releases in 24 hours (plus weeknotes) - 10th April 2024
- Building files-to-prompt entirely using Claude 3 Opus - 8th April 2024
- Running OCR against PDFs and images directly in your browser - 30th March 2024
- llm cmd undo last git commit - a new plugin for LLM - 26th March 2024
- Building and testing C extensions for SQLite with ChatGPT Code Interpreter - 23rd March 2024
- Claude and ChatGPT for ad-hoc sidequests - 22nd March 2024
- Weeknotes: the aftermath of NICAR - 16th March 2024