Related Discussions:
http://area51.phpbb.com/phpBB/viewtopic.php?f=105&t=35616
http://www.phpbb.com/community/viewtopic.php?f=64&t=2100309
A URL is the gateway to your website, and how web pages can be accessed. The common movement on the web is to more towards a RESTful way to interface with web applications.
Benefits
- User can be clued into where they are going by just looking at the URL
- Keywords in the URL
- Could pave the way for more seemless integration in APIs introduced later on
- Potential release of sensitive information via referrers
- Rewriting URLs can cause additional load on the webserver
The implementation sample below is what I have worked out with the following in mind:
- Avoid all URL collisions without looking up topics
- Allow for old URLs (?f=12&t=34) to work and be redirected
- Accommodate changing topic names
- Language neutrality
- Code: Select all
/ Index
/forum-name-f12/ Forum ID 12
/forum-name-f12/my-topic-t4/ Topic id 4
/forum-name-f12/post/ New topic in forum id 12'
/forum-name-f12/my-topic-t4/reply/ Reply in topic 4
/memberlist/ Memberlist
/memberlist/leaders/ Leaders
/member/sam-m2/ Member ID 2
/group/group-name-g4/ Group 4
/ucp/{i}/ Default GET params in the URL
/ucp/{i}/{mode}/
/mcp/{i}/ Default GET params in the URL
/mcp/{i}/{mode}/
/search/ Just use REQUEST for the rest except for special case
/search/egosearch/ Ego search
The idea here would be to covertly stuff the ID (and some identifier to show what sort of ID it is) into the URL. This ensures that collisions are impossible and will not require lookups to check for similar url slugs.
When you submit a topic, it will clean the title out and tack on "-t{ID}" to the end to produce the final slug. This is stored in the database. When you visit a page, it will go only by the topic ID, where the rest of the text is simply dummy text. The page will check if the the URL slug is correct and redirect if it does not match the one stored in the database. This will allow topic title changes to happen seamlessly, and the 301 will tell search engines to update their links.
An example of a redirect:
- User clicks an old url:
http://www.phpbb.com/community/viewtopic.php?f=14&t=2133523 - htaccess (which is not aware of anything DB side) will redirect here:
http://www.phpbb.com/community/f14/t2133523/ - User lands on the page, which detects the slugs do not match. It will then direct them here:
http://www.phpbb.com/community/announcements-f14/phpbb-at-oscon-july-26-28-t2133523/
Comments/Suggestions?





