Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search Engine Frienly URL's?
first of all, this script is awesome!
what i want to know is if there is something in the making like "Search Engine Friendly" URL's.
so instead of:
comments.php?DiscussionID=507&page=1#Item_0
it should say
comments/507/1/
or something like that..
i see this as one of the biggest missing features in vanilla.
any ideas of how this could be done?
0
Comments
RewriteEngine on Options +FollowSymlinks RewriteBase /vanilla/ RewriteRule ^comments/([0-9]+)/([0-9]+)/?$ comments.php?DiscussionID=$1&page=$2 [L]
Change line three from /vanilla/ to whatever directory your forums are living in, or just leave as / if they're in the base directory.
It does mess things up a bit tho, as vanilla is built to have no extra directory, and requests only files. As a result, all js and CSS links are invalid. You'll have to add a base link in the head element of your forum to change this.
<base href="http://www.yoursite.com/vanilla/" />
customising as needed.
And, as the extensions capability of Vanilla doesn't appear to extend to control classes, you'll have to hard code this into your site (please, please correct me if I'm wrong) :
controls/Common.Controls.php, line 350.
Add in your <base /> element just after the <head> tag, and that should all work!
M.
Check out my response in your other thread
If one was especially clever one could write some Javascript to do it for you; crawl through all the links, check if their hrefs match a regular expression...if so alter the link so that the href is now formatted to a clean url.
This won't help search engine crawling (as they don't use Javascript) but it will make things nicer for users.
The only problem being that it might be a bit slow, particularly on older machines.
M.
BTW the mod_rewrite rules for the other likely commands would look something like this :
RewriteEngine on Options +FollowSymlinks RewriteBase /forums/ RewriteRule ^comments/([0-9-]+)/([0-9-]+)/?$ comments.php?DiscussionID=$1&page=$2 [L] RewriteRule ^categories/?$ categories.php [L] RewriteRule ^categories/([0-9-]+)/?$ ?CategoryID=$1 [L] RewriteRule ^search/([A-Za-z0-9]+)/([A-Za-z0-9-]*)/?$ search.php?PostBackAction=Search&Keywords=$2&Type=$1 RewriteRule ^account/([A-Za-z0-9]+)/?$ account.php?PostBackAction=$1
where URL would be (in order):
- /comments/123/45/
- /categories/
- /categories/3/
- /search/Topics/foo/ or /search/Comments/foo/
- /account/Password/ or /account/Style/
Etc. They're not too hard to make yourself, but if it helps someone then there you are!M.
If a specific category is selected it might look like:
domain.com/basefolder/1/
1 being the category ID
And if a thread (take this one for example) is selected it would turn out like:
lussumo.com/community/comments/DiscussionID/648
stripping out the
.php
and removing all the?
and&
's and turning them into forward slashes that would resemble a proper path.In other words, all mod_rewrite is doing is simply breaking down the url into a formatted query apache (or whatever other webserver) understands. Thus allowing your request to get passed via a secondary method while the original (complex looking) one is still available. Behold the power of regular expressions.
my question was a thinly veiled request that this be made to include (if it didn't already) the category title and thread title in the url. i know that it is possible, but i have no idea on the complexity.
maybe
domain.com/forum/general-whatever-category/actual-comment-title
1. strip out all non-alpha-numeric characters from the topic and replace spaces with dashes.
2. check the database to see if that discussion-code already exists
3. If not, save it. If so, check to see if that code + "-2" exists.
4. If not, save it. If so, check to see if that code + "-3" exists.
5. etc etc etc
That's a bit of overhead, and I would seriously hate to program that. I don't know why, I just would.
But even then - at the end of the day maybe you're just looking for a hint about what thread you're looking at. I mean, take a look at a discussion url for yayhooray:
http://www.yayhooray.com/thread/53042/I-am-a-complete-and-utter-douchebag
As you can see, they've *also* got the thread id in their url - so that text after the number is really just a visual reference for what the discussion may be about - and that would be pretty easy to pull off.
I was thinking that I might do something like this...
http://lussumo.com/munity/648/1/Search-Engine-Frienly-URLs
Where 648 is the DiscussionID, 1 is the page number, and the rest is just a visual reference.
Any idea how long it'd take to implement this feature?
Dan