News:

Wondering if this will always be free?  See why free is better.

Main Menu

Pretty URLs

Started by SMFHacks.com Team, January 31, 2007, 10:56:43 AM

Previous topic - Next topic

Dannii

http://www.simplemachines.org/community/index.php?topic=146969.msg968208#msg968208
It's the same here.
The .msg part tells SMF which message is being view, so that it can show the right page.
The #msg part isn't actually part of the url. It's a fragment, and is used by the browser to take you to a particular location of the page. It either isn't sent to the server, or if it is, is ignored.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

schled

Thanks for a great mod! I too think this should be a part of core smf!!

My only question; is it possible to use the topic etc id numbers rather than name? What would happen to links if a topic name changes? Is anyone able to point me in the right direction to change this?

Dannii

If a topic name changes, the pretty url to it won't. (I will eventually add a mod feature to allow changes to the pretty url though.)
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

hawkshaw

#103
I tried it to my test forum. Boardindex.php test failed while installing, i ignored it.

When i hovered on a thread link, the link's been changed into prettyurl link.. but when i clicked it, i got this error message :
Quote
Not Found
The requested URL /testforum/general-discussion/welcome-to-smf/0/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

stoecki

you probably missed to rename the .htaccess file  ;)

CyberOto

Hi,

I have just tried to install the Pretty URLs mod on a clean installation of SMF 1.1.2 and got this

QuoteInstallations actions for "Pretty URLs - Extention: none":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    -    Modification parse error
2.    Execute Modification    ./Sources/Stats.php    Test successful

when trying to install the extension. I have ignored the error and installed the mod, but alas.

The .htaccess file is renamed and the host have mod_rewrite working on it.

Any ideas ?

Thanks in advance.

moonrock

 I don't seem to get it work.

my forum root is at /forum/
and i edited the .htacess (yes..i've renamed it from example.htaccess)
the .htaccess file is in my forum root

Quote#   Example .htaccess file for the SMF Pretty Urls mod
#   If you already have a .htaccess file you will have to manually edit this and that file together. If not, you should be able rename this file to .htaccess and have it work without any changes. The default options should work, but other possible options are also provided commented out (for example, if you want to change the base location to /forum/)

RewriteEngine on

#   Pretty board urls
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

#   Pretty topic urls
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/msg([0-9]*)/?$ ./index.php?pretty;board=$1;topic=$2.msg$3 [L,QSA]
RewriteRule ^/forum/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/new/?$ ./index.php?pretty;board=$1;topic=$2.new [L,QSA]

#   To change the base url, just add the child folder name to the front of the pattern. Example:
#   RewriteRule ^/forum/([-_a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]

but still the URL is not found when i click on the url
did i miss something ?

Dannii

If your forum's index.php is in /forum/ and so is your .htaccess, you don't want to do that. Adding on a directory like that is useful only for pretend directories, or if your .htaccess isn't in the same location as your forum's index.php
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

moonrock

Quote from: eldʌkaː on February 21, 2007, 09:22:52 PM
If your forum's index.php is in /forum/ and so is your .htaccess, you don't want to do that. Adding on a directory like that is useful only for pretend directories, or if your .htaccess isn't in the same location as your forum's index.php

yes my forum index.php is in the /forum/ .. of course.
so i shouldn't do that ?? what do I do then ?

the renamed .htaccess is in my forum root.
but i still get the 404 error

CyberOto

Quote from: moonrock on February 22, 2007, 10:43:43 AM
Quote from: eldʌkaː on February 21, 2007, 09:22:52 PM
If your forum's index.php is in /forum/ and so is your .htaccess, you don't want to do that. Adding on a directory like that is useful only for pretend directories, or if your .htaccess isn't in the same location as your forum's index.php

yes my forum index.php is in the /forum/ .. of course.
so i shouldn't do that ?? what do I do then ?

the renamed .htaccess is in my forum root.
but i still get the 404 error

a) move the .htaccess file outside the forum folder
b) remove the /forum from RewriteRule


Cheers

Carlos Gandra

Quote from: CyberOto on February 21, 2007, 07:22:46 AM
QuoteInstallations actions for "Pretty URLs - Extention: none":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    -    Modification parse error
2.    Execute Modification    ./Sources/Stats.php    Test successful

Exactly same problem here... :(
Carlos Gandra
Mundo dos Animais

Dannii

Do other mods work? Anything in the error log?
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

moonrock

Quote from: CyberOto on February 22, 2007, 12:36:59 PM
Quote from: moonrock on February 22, 2007, 10:43:43 AM
Quote from: eldʌkaː on February 21, 2007, 09:22:52 PM
If your forum's index.php is in /forum/ and so is your .htaccess, you don't want to do that. Adding on a directory like that is useful only for pretend directories, or if your .htaccess isn't in the same location as your forum's index.php

yes my forum index.php is in the /forum/ .. of course.
so i shouldn't do that ?? what do I do then ?

the renamed .htaccess is in my forum root.
but i still get the 404 error

a) move the .htaccess file outside the forum folder
b) remove the /forum from RewriteRule


Cheers

tried all!.. still 'Requested URL not found'

- moved .htaccess outside forum and also keep it inside
- renamed /RewriteRule and also using default

all doesn't work!!

though i can see the links are change to Pretty URLs, but unable to link it to the topic..etc..

what did i miss ?

Dannii

Can you give a link to your forum please.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

schled

Since installing this mod, I have multiple entries each of

File does not exist: /home/forum.url.com/html/forum-category

and

Premature end of script headers: php5, referer: http://forum.url.com/forum-category/topic-name/0/

in my error log.

Could the first error be due to robots searching?

Dannii

It could be.. is your .htaccess file working properly?
I don't know what the cause of the second is, but I doubt it's got much to do with this mod.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

schled

The forum and mod seem to be working perfectly. Perhaps my host is just having some issues :( I thought they were strange errors.

Carlos Gandra

#117
Quote from: eldʌkaː on February 28, 2007, 10:35:40 PM
Do other mods work? Anything in the error log?

Hi,

Well, I decided to install manually and it was a good exercise... more than an hour to install the Major.xml 8)

Is working now :D but I need some technical support from you (or any other member) in one thing: my Forum is Portuguese, so it have characters like à, ú, ç, etc, frequently, and when it happens, it do not transmite the name of the board and topic, but the number of the board and the number off the topic...

Please check it: http://forum.mundodosanimais.pt/, for example:
Without "special" characters: http://forum.mundodosanimais.pt/sugestoes/
With them: http://forum.mundodosanimais.pt/b25/0/

I've got to the Subs-PrettyUrls and I tried everything... make html entities, numerical entities, the characters itself (inside the '',) but nothing works. I've also tried to modify the encode of the entire page, done it but the desired effect doesn't apppear.

I really appreciate any help that could be given to me ;) (please consider a-priori that I can't put all of my forum in UTF-8)

Eldaka, congrats for this mod, I hope you keeping developing it because is an essential part of the seo-competition today.

Regards

Carlos Gandra
Mundo dos Animais

Dannii

The code that matters is the generatePrettyUrl() function of Subs-PrettyUrls.php

The preg_match_all() function is supposed to accept any encoding, and convert it to Unicode, but prehaps it isn't.

Hm... actually I think I got that backwards. It looks like it only accepts UTF-8 :S weird. Which encoding do you use?

I think I'll have to put something on the download page that this mod is designed for UTF-8 and that the results will be unpredictable in other encodings. Hopefully we can get it working in all of them though :)
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

eladio

is there any chance to see a version  for forum on WIN server  :(  :'(


Advertisement: