Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Dannii on November 14, 2006, 08:42:05 AM

Title: Pretty URLs
Post by: Dannii on November 14, 2006, 08:42:05 AM
Home page: http://code.google.com/p/prettyurls/
Source code: http://prettyurls.googlecode.com/svn/trunk/
Download: http://code.google.com/p/prettyurls/downloads/list
Example/dev forum: http://dev.eldacar.com/prettyurls/

I've uploaded what I'm working on. I won't be providing support yet, but feel free to try it for yourselves, and also report any bugs.

Please post and spam anything you like in the dev forum, especially if it uses funky characters.
Title: Re: Pretty URLs
Post by: kL on November 15, 2006, 08:03:05 AM
sorry for being stupid but how do i install it?
Title: Re: Pretty URLs
Post by: Dannii on November 15, 2006, 08:11:38 AM
You can make packages out of the files in the Base and ext-none directories, installing Base before ext-none. You will have to add 'pretty_board_urls' to the settings table first though.
And you'll need a .htaccess file, you can use the one here (http://prettyurls.googlecode.com/svn/trunk/htaccess) as an example.
Title: Re: Pretty URLs
Post by: Daniel Hofverberg on November 15, 2006, 08:15:09 AM
How does it work, and how would URLs look after installing this? For those of us, who can't quite make sense of the code...
Title: Re: Pretty URLs
Post by: Dannii on November 15, 2006, 08:18:55 AM
You can see an example at http://ftgforums.com/private/pretty/
Only boards are done, and only on a few topics, so far.. I'll be working to get the others working too ;)
Title: Re: Pretty URLs
Post by: iamvedau on November 15, 2006, 08:51:42 AM
i was upload chmod to 666 and cmod /source but i can install it i have arlet :
You cannot download or install new packages because the Packages directory or one of the files in it are
not writable!
i luv it can u tell me how to install it ?
Title: Re: Pretty URLs
Post by: Dannii on November 15, 2006, 09:08:05 AM
Please search around, there have been a thousand topics answering that before.
As I said above, I don't really want to provide support for this until it is at a really usable stage. Use at you own expense! :)
Title: Re: Pretty URLs
Post by: Dannii on December 09, 2006, 02:09:35 AM
Okay, it's a working stage now. Please install the base package first, rename example.htaccess to .htaccess (edit it if you want to) and then install the ext-none package. Enjoy.

This version does only pretty URLs for boards, and only on certain templates.
Title: Re: Pretty URLs
Post by: apc on December 09, 2006, 11:05:43 AM
This looks very promising and much needed!

Do you intend to take it the the status of a full blown mod installed through Admin?
Title: Re: Pretty URLs
Post by: Dannii on December 09, 2006, 09:38:55 PM
I'll probably keep it roughly the same as it is now. I'm using multiple packages for two reasons: it's harder to screw everything up because you can test whether your new urls will work before you actually change the urls outputted by your forum, and because you can then have multiple formats. I prefer to have extentionless urls (/board/topic/0/) but some might want other formats (/board/topic.0.html for example).
Title: Re: Pretty URLs
Post by: Daniel Hofverberg on December 10, 2006, 12:17:50 PM
Sounds good to me. Do you have an estimate when pretty URLs will work for topics too, and not just boards?
Title: Re: Pretty URLs
Post by: Dannii on December 10, 2006, 08:56:33 PM
Not yet. The boards are quite easy as it's all done through an array stored in the settings table. The topic urls won't be. I'm still trying to decide which way would be best to store them.
Title: Re: Pretty URLs
Post by: Dannii on December 13, 2006, 05:32:55 AM
Guess what? Topic URLs are done already :)

This is the proper 0.1 release.

Again, please install the base package first, rename example.htaccess to .htaccess (edit it if you want to) and then install the ext-none package. Enjoy.

[Edit] Just installed it on my 30907 posts, 1332 topics forum, and it seems to be working perfectly! I was worried it might time out PHP, but it would probably only do that on huge forums.
Title: Re: Pretty URLs
Post by: Daniel Hofverberg on December 13, 2006, 05:54:50 AM
How does topic URLs look like with this mod? I couldn't quite make that out from the code...
Title: Re: Pretty URLs
Post by: Dem0n on December 13, 2006, 06:00:33 AM
Quote from: eldʌkaː on December 13, 2006, 05:32:55 AM
Guess what? Topic URLs are done already :)

This is the proper 0.1 release.

Again, please install the base package first, rename example.htaccess to .htaccess (edit it if you want to) and then install the ext-none package. Enjoy.

[Edit] Just installed it on my 30907 posts, 1332 topics forum, and it seems to be working perfectly! I was worried it might time out PHP, but it would probably only do that on huge forums.

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.
Title: Re: Pretty URLs
Post by: Dannii on December 13, 2006, 06:02:22 AM
http://ftgforums.com/serious/judaism/msg30990/?topicseen#msg30990
IE: http://forum root/board name/topic name/message number/?everything else

Dem0n, it is only for SMF 1.1. What are you using?
Title: Re: Pretty URLs
Post by: Dem0n on December 13, 2006, 06:03:52 AM
Quote from: eldʌkaː on December 13, 2006, 06:02:22 AM
http://ftgforums.com/serious/judaism/msg30990/?topicseen#msg30990
IE: http://forum root/board name/topic name/message number/?everything else

Dem0n, it is only for SMF 1.1. What are you using?

Oh, well that explains it. Im using RC3 right now, maybe I shall upgrade.
Title: Re: Pretty URLs
Post by: Niteblade on December 13, 2006, 09:17:37 AM
Nice.
Title: Re: Pretty URLs
Post by: Niteblade on December 13, 2006, 09:19:47 AM
Quote from: eldʌkaː on December 13, 2006, 06:02:22 AM
http://ftgforums.com/serious/judaism/msg30990/?topicseen#msg30990

When I go to this link, ... which puts me on page 2, ... Pages 1 [2] ...I get an error when I scroll down and click on page 1 ... Page [1] 2 ... . http://ftgforums.com/serious/judaism/msg30990/0/
Title: Re: Pretty URLs
Post by: Dannii on December 13, 2006, 09:21:51 AM
Hmm, thanks for spotting that :)
I've actually found a few errors, that release wasn't as bugfree as I had hoped. :(
Title: Re: Pretty URLs
Post by: Niteblade on December 13, 2006, 11:06:06 AM
The fact that you're taking the time to release such a useful modification for v1.1 more than makes up for any bugs. Thanks !!! This will be an awesome mod !!
Title: Re: Pretty URLs
Post by: SEO on December 14, 2006, 04:05:39 AM
Sorry i been away a bit and neglected the smfseo forum and project.

Have you taken over the smfseo project from chris now eldacar?
Title: Re: Pretty URLs
Post by: Dannii on December 14, 2006, 06:20:16 AM
Nope, this is all my own work. Completely different method too, just to ensure there can't be any problems with copyright issues :)
Title: Re: Pretty URLs
Post by: Niteblade on December 14, 2006, 11:42:41 AM
I've been fooling around with Seo4Smf. I have it running right now on my forum : http://forum.midessa.net .. (example : http://forum.midessa.net/flickr-photos-other-internet-photos/uncle-bens-country-inn-oriental-fried-rice-t410.0.html )

Have you played around with it ?
http://www.webmasterstalks.com/seo_4_smf-b46.0/

Title: Re: Pretty URLs
Post by: Dannii on December 14, 2006, 09:35:47 PM
Yes i've seen it, and I don't want to have the topic numbers in my forum so I'll keep developing mine ;)
Well, topic numbers are used for duplicate titles, but that's all.
Title: Re: Pretty URLs
Post by: Dannii on December 17, 2006, 07:59:16 AM
I've found the solution to the bug - I had actually already made the change required in my testing forum, and it was in the mod there, but it wasn't on my local computer. Prehaps I clicked undo before saving accidentally? Something silly like that must have happened :P
Title: Re: Pretty URLs
Post by: Roph on December 17, 2006, 10:09:16 AM
Say if I installed this, would the hundreds of links already posted by users on my forum to other topics and posts all still work?

When the forum went from no SEO --> SMF's default built in SEO, it broke all of the internal links, which I'd rather not do to my users again.
Title: Re: Pretty URLs
Post by: Panzer- on December 17, 2006, 12:59:56 PM
QuoteWhen the forum went from no SEO --> SMF's default built in SEO, it broke all of the internal links, which I'd rather not do to my users again.

Do you have a Microsoft host?


Great mod man, i cant wait to use it when it gets more stable. Does it conflict with the built in "pretty URLS" ?
Title: Re: Pretty URLs
Post by: Dannii on December 17, 2006, 09:14:20 PM
Silverline, the old links would still work. At the moment it doesn't redirect from standard to pretty urls, but it will later. In that case it will still work. I might even be able to get a file up to do a search and replace through the posts.

Panzer, you couldn't use both at once, although at the moment it doesn't touch anything that produces the built in SEO friendly URLs. I've never used those so I wouldn't know what would happen if you tried to use both.
Title: Re: Pretty URLs
Post by: Dannii on December 26, 2006, 04:01:03 AM
I've released version 0.2, get it at http://code.google.com/p/prettyurls/downloads/list
There are a few small bugfixes, but the major change is that the topic urls have been replaced in SSI.php, News.php and Recent.php with pretty URLs :) (which means the unread posts page will work) I think I've replaced all the topic and board urls in the templates which I'd call major.. I still plan to replace the others though, and also to put a filter on at the end to replace any that get missed.
Title: Re: Pretty URLs
Post by: allumius on December 26, 2006, 06:59:13 AM
Sorry but my english is very bad

Ii've smf1.1.1+tinyportal0.97+ancient & rusted theme

i install:
Pretty URLs - Extention: none 0.2 
Pretty URLs - Base 0.2 

I rename de example..htaccess to ..htaccess

but my forun return this error:
Forbidden

You don't have permission to access /politica/0/ on this server.


if i want to entry in politica forum
if i want to entry in musica forum:
Forbidden

You don't have permission to access /musica/0/ on this server.


Help me please


Title: Re: Pretty URLs
Post by: Roph on December 26, 2006, 07:38:10 AM
If your forum is in a subfolder, you'll need to edit the htaccess file (an example is included inside the file).




I tried installing this mod myself (on a test forum on my own (windows) machine), though I just get internal server errors, so, hmm.
Title: Re: Pretty URLs
Post by: Dannii on December 26, 2006, 07:45:53 AM
QuoteI rename de example..htaccess to ..htaccess
There should only be one dot. It should be named exactly .htaccess
Also, this will only work on apache servers with mod rewrite enabled.
Title: Re: Pretty URLs
Post by: allumius on December 26, 2006, 11:05:59 AM
Quote from: Silverline on December 26, 2006, 07:38:10 AM
If your forum is in a subfolder, you'll need to edit the htaccess file (an example is included inside the file).




I tried installing this mod myself (on a test forum on my own (windows) machine), though I just get internal server errors, so, hmm.

my forum is www.losamigotes.org and is not in a subfolder (you can see)

Quote from: eldʌkaː on December 26, 2006, 07:45:53 AM
QuoteI rename de example..htaccess to ..htaccess
There should only be one dot. It should be named exactly .htaccess
Also, this will only work on apache servers with mod rewrite enabled.

Sorry, the double dot. is an error to write. I rename .htaccess
where can i see if my server is apache server?
where can i download de mod rewrite?

Title: Re: Pretty URLs
Post by: Dannii on December 26, 2006, 10:42:05 PM
A phpinfo will tell you what server you're on, and whether you have the mod installed. If you make it and then post a link to it here I can tell you
http://docs.simplemachines.org/index.php?topic=479.0
Title: Re: Pretty URLs
Post by: allumius on December 27, 2006, 04:43:32 AM
I send you one private mensage
Title: Re: Pretty URLs
Post by: Dannii on December 27, 2006, 05:08:30 AM
Your server is running Apache, but as it's running as CGI, I can't tell whether or not it has mod_rewrite. You'll have to ask your host if they support it, unfortunately it's not something you can install for yourself if they don't.
Title: Re: Pretty URLs
Post by: Tarek on December 29, 2006, 08:18:03 AM
i am receiving an error 404 page not found .
do i have to download any .htacess file ?
Title: Re: Pretty URLs
Post by: Dannii on December 29, 2006, 08:28:55 AM
There is one included. You will have to rename it from example.htaccess to .htaccess though.

All, I've found a small bug. If you make a new board, you'll get an error, because I didn't include the source file needed. If you get the error, you can fix it by searching for this:
// Update the pretty board URLsAdd after:require_once($sourcedir . '/Subs-PrettyUrls.php');
Title: Re: Pretty URLs
Post by: Tarek on December 29, 2006, 10:17:02 AM
Ok , i have renamed the .htaccess file and it is working now :)

thank you .

i got an idea ,
why don't you add more option in admin area ...
i have 3 letter domain i am using as a forum .
so if there is an option to view the topic as :
forumurl/t15.htm
or
forumurl/b5.htm

so it will be better to keep the short link style :)
Title: Re: Pretty URLs
Post by: Dannii on December 29, 2006, 06:07:12 PM
I don't want to have the numbers in the urls. I just suggested this to you as it might help, but if you really want those short URLs, then you'll have to look at another mod.
Title: Re: Pretty URLs
Post by: Tarek on December 30, 2006, 03:21:29 AM
well ,
if i only installed the ext without the base , i will have the links in only numbers ..
did you try it ?
Title: Re: Pretty URLs
Post by: Dannii on December 30, 2006, 06:13:59 AM
You could try that I suppose. You'll still need to set up some of the arrays (as empty) or else you'll get errors. And.. it will be making a lot more database queries than you need. If all you want is a short form, you might be better off editing the mod by sacx, because it doesn't do any extra queries.
Title: Re: Pretty URLs
Post by: SacmaliK on December 30, 2006, 11:45:38 PM
Turkish characters  :(
Title: Re: Pretty URLs
Post by: Dannii on December 31, 2006, 12:08:06 AM
http://dev.eldacar.com/prettyurls/test-board-1/c-o-u-turkish-character/msg19/?topicseen#msg19

(I had to fix it manually, because the topic urls aren't automatically made when you make a new topic yet)

So the Ç, Ö and Ü are working, I'll add in the Ş, Ğ and İ (and their lowercase characters). Any other Turkish characters?
Title: Re: Pretty URLs
Post by: SacmaliK on December 31, 2006, 12:37:30 AM




Ş - Ç - Ö - Ü - Ğ - İ : Turkish  Big character
ş - ç - ö - ü - ğ - ı : Turkish  small character

The all of the character these
You interested for thanks
Title: Re: Pretty URLs
Post by: nediam on January 03, 2007, 11:11:41 AM
Hello.
I have some problem with pretty URLs after installation i have beautiful pretty URLs like "http://somehost.com/forum/some-board/some-topic/0/" but when i add new post it have URL like "http://somehost.com/forum/some-board/1/0/" what's wrong ?
Title: Re: Pretty URLs
Post by: Dannii on January 04, 2007, 03:02:28 AM
The last release (0.2) of the mod doesn't automatically add the pretty urls for new topics to the database. It should still work perfectly fine though, and then when I release 0.3, it will do it automatically for you (as well as adding all the old topics).
Title: Re: Pretty URLs
Post by: Stüldt Håjt on January 17, 2007, 09:46:05 AM
How much do you think this will increase the page load?
Title: Re: Pretty URLs
Post by: Dannii on January 17, 2007, 06:34:45 PM
I'm not sure.. it adds one new query per page and then makes several of the other queries a little larger. I haven't noticed any big load increase though.
Title: Re: Pretty URLs
Post by: Sindorf on January 18, 2007, 12:10:21 PM
Hi,

This is really a good project. I appreciate your efforts and I want to thank you for your work and time.

I have created a test topic in your forum. This is what I have posted

http://dev.eldacar.com/prettyurls/test-board-1/ss-gg-ii-uu-cc-oo-dollar-percent-and/0/

and

http://dev.eldacar.com/prettyurls/test-board-1/g-u-i-s-c-o-u-g-i-s-c-o-plus-dollar-percent-and/0/

You can see that characters like " ' # { are not working.

I know this project is in an early stage but I wanted to inform you about these.

Thanks :)
Title: Re: Pretty URLs
Post by: Dannii on January 18, 2007, 10:00:50 PM
Yeah.. I'm not entirely sure what to put for them though. "doublequote" for example is obviously too long..
Any suggestions?
Title: Re: Pretty URLs
Post by: Stüldt Håjt on January 19, 2007, 04:37:15 AM
I think you shoud just delete all ?=)(/&%¤¤#"! etc because the longer the url less search engines likes it.
Title: Re: Pretty URLs
Post by: Sindorf on January 19, 2007, 05:55:24 AM
Hi Eldakar,

I am totally with Stüldt Håjt's idea. You can remove these from the link. Nobody will write a topic like "][" or "$$%%%&&&" in an active forum. (At least, when people start to post like these, I will start to ban them :))

Generally, the URL rewrite of some other systems (like WordPress) works like this (they remove that "'!^#+%body%quot; charactersin URLs)

A second option is that you can add only the first letters of the marks, for example ? is quotation mark, the "pretty url"ed of this can be "qm" => But that's a bad idea :)
Title: Re: Pretty URLs
Post by: webmistress on January 19, 2007, 11:40:07 AM
Quote from: eldʌkaː on December 29, 2006, 08:28:55 AM
All, I've found a small bug. If you make a new board, you'll get an error, because I didn't include the source file needed. If you get the error, you can fix it by searching for this:
// Update the pretty board URLsAdd after:require_once($sourcedir . '/Subs-PrettyUrls.php');

Okay, it works and it worked fast! I'm about to faint. Thank you.

I do have a question about the above. In which file do I look for this to make the change? It may be obvious. Is it in install.php? I've looked for it but don't see the "//Update the pretty board URLs" it right off the bat. Thanks.
Title: Re: Pretty URLs
Post by: webmistress on January 19, 2007, 01:54:32 PM
Okay, I've now done an exhaustive search for these words "Update the pretty urls" and don't see them, the ones above. The new board has a number and not the pretty urls, so I think I need to modify something in one of the files.
Title: Re: Pretty URLs
Post by: Dannii on January 19, 2007, 08:36:26 PM
QuoteOkay, I've now done an exhaustive search for these words "Update the pretty urls" and don't see them, the ones above. The new board has a number and not the pretty urls, so I think I need to modify something in one of the fil
I should be in Sub-Boards.php

QuoteI think you shoud just delete all ?=)(/&%¤¤#"! etc because the longer the url less search engines likes it.
Some of them can't be used because they do stuff in urls, like ? = & and #
However some of them make sense in a topic and should be preserved. Your topic might be something like "50% sale on now!", and so that should be converted to "50percent-sale-on-now". And "you & me" should be converted to "you-and-me". The others won't work like that though.
Title: Re: Pretty URLs
Post by: Stüldt Håjt on January 19, 2007, 10:23:59 PM
If someone makes a thread like I love you!1111oneleven<3"#¤%&/ It should definitely shorted like i-love-you.

I think it looks stupid if you have a topic like "do-you-like-me-questionmark-questionmark-questionmark-questionmark-questionmark-questionmark-questionmark-questionmark-questionmark-questionmark etc..."
Title: Re: Pretty URLs
Post by: Dannii on January 19, 2007, 10:25:07 PM
True, I don't think I'll have questionmark..
I'll also add in a later version a way to change the url of a topic/board, so if there is something you don't like you can fix it.
Title: Re: Pretty URLs
Post by: webmistress on January 19, 2007, 11:35:07 PM
Quote from: eldʌkaː on January 19, 2007, 10:25:07 PM
True, I don't think I'll have questionmark..
I'll also add in a later version a way to change the url of a topic/board, so if there is something you don't like you can fix it.
I think we all might have to be in love with you if you do that.

Would this

//Update the arrays

be the same as this?

// Update the pretty board URLs

Because I'm not finding those exact words. And this seems the closest as update database doesn't seem right. I'm not a programmer (obviously). I sure that is not a complete surprise to you given how intelligent my and in-depth my questions are.

And I notice I can't write on the file in the admin window. I have permissions set right, but it's still in a zip file. So I'm guessing I'd have to unzip it locally and upload the file? I've not done that before so sorry for asking you to hand hold.

I am already hooked, addicted to the pretty urls. Now that I am addicted my new boards have to have them, too. I absolutely cannot live without it. So if you don't have directions you're going to have to reccommend a 12-step program to wean me off the pretty urls.

I guess I could uninstall and install about once a week. That might do the trick as well.
Title: Re: Pretty URLs
Post by: Dannii on January 19, 2007, 11:40:25 PM
I've just release a new version of it, and it will soon be on the mod site. Try installing that one instead to see if fixes the problems.
Title: Re: Pretty URLs
Post by: webmistress on January 20, 2007, 09:37:45 AM
GREAT. Thank you. Do post here when you upload it. Many thanks. I don't think I'll shrivel up before then. It is a way cool mod and it makes tracking the stats in my counter really easy, too.
Title: Re: Pretty URLs
Post by: ketchup on January 24, 2007, 05:18:22 PM
Hi ...my version is : Powered by SMF 1.1.1   so i shoudn't install this right?
Title: Re: Pretty URLs
Post by: Dannii on January 24, 2007, 08:38:55 PM
No you can install it. Make a backup first to be safe.
Title: Re: Pretty URLs
Post by: webmistress on January 29, 2007, 03:11:41 PM
[code]Fatal error: Call to undefined function: generateprettyurl() in /home/file/anotherfile/yetanotherfile/Sources/Subs-Boards.php on line 1074[/code]

The pretty urls works until I try and add another board. When I do, I get the above error.

I no longer have a theme (too many issues) and have reverted to classic. Any ideas?
Title: Re: Pretty URLs
Post by: Dannii on January 29, 2007, 09:43:55 PM
If you upload your Subs-Boards.php, I'll fix it for you.
Title: Re: Pretty URLs
Post by: webmistress on January 30, 2007, 12:54:05 PM
I'll take you up on this. I just added a test account. I'll PM you. I need to give the test account admin priveleges but I don't know how to do that. Still finding my way around the admin menu.

Thanks.

I did install it but I'm not going to add any boards yet.
Title: Re: Pretty URLs
Post by: webmistress on January 30, 2007, 08:20:59 PM
I just downloaded 3. But do I need more than one of those files?
Title: Re: Pretty URLs
Post by: Dannii on January 30, 2007, 08:22:54 PM
Firstly uninstall any older versions. Then install the 0.3 base package. After that you can go to "download packages" and select the "Pretty URLs Package List". Install "Pretty URLs - Extention: none" and "Pretty URLs - TinyPortal - Extention: none" if you use TinyPortal.
Title: Re: Pretty URLs
Post by: webmistress on January 30, 2007, 08:32:09 PM
http://code.google.com/p/prettyurls/ (http://code.google.com/p/prettyurls/)

Prettyurls for search engines optimization (key words)

Above is the link where you get this new version.

eldʌka-It is working quite beautifully. I uninstalled the previous, and uploaded the new. Took all of 1 minute.

I was starting to shake from "pretty url withdrawal" being the marketing "ho" that I am.

Thank you. It is making me very happy. I added a new board and so far no errors.   
Title: Re: Pretty URLs
Post by: Dannii on January 31, 2007, 12:44:45 AM
I'm glad it's working for you :)
I admit, I love it too!
Title: Re: Pretty URLs
Post by: Dannii on January 31, 2007, 08:34:29 PM
http://www.simplemachines.org/community/index.php?topic=146969

Use this topic now :)