Pretty URLs

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

Previous topic - Next topic

vbgamer45

Quote from: raing3 on January 30, 2010, 05:21:15 AM
I was hoping that there was a simple PHP script which could help with the replacing of Pretty URLs with their respective original URLs in posts and possible PMs and signatures.

I have given it a quick go at writing a script but I failed. The reason I wish for such a script is because I regularly clean out the pretty URLs cache so that URLs can be regenerated for when topics are renamed or moved between boards, doing so causes links to the previous URLs on the forum to become inaccessible.

This would also come in handy as I am considering using SimpleSEF instead of Pretty URLs as it uses the topic id/board id etc. as part of the links so when the name of the topic/board etc. changes all previous links still remain valid.

Thanks for any time and help, I already checked the troubleshooting page and their doesn't seem to be any information about this.
So what are you saying when rename a topic or move a topic to a different board. The old link to the topic no longer works but the new link is fine.  Are you looking a script that will still keep the old links active but redirect them to the new location?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Nao 尚

No, I think basically he's looking for some functionality similar to what I did in my own install of PrettyURLs (http://nao.noisen.com for instance) -- having topic IDs in the URL so that the topic can always be found, regardless of the topic name in the URL (it's only there for... a pretty and informative URL.) Additionally, it saves some time to make a search on the topic ID rather than the cached name. Two pros and only one con (slightly longer URL).
In any case, it's easy to implement.
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

vbgamer45

hmm. The only issue I could see with using the id would be you would have two links to the exact same content you would still want to do a 301 redirect for the old links otherwise you might take an SEO hit
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Nao 尚

There's no such SEO hit. Don't forget that SMF2 adds support for canonical links. I don't know if it's supported by PrettyURLs but mine supports it, and turns it into the current URL.

Eh, told ya I wanted to inherit the mod :P
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Özgür

vbgamer are you taking over this mod or this is temporary?
So Long

vbgamer45

Yes mod will remain here on the modsite and will be upadted. Focus is going to be fixing any bugs that correctly exist and then integrating with other mods.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

SlammedDime

Quote from: Nao on January 30, 2010, 11:16:17 AM
No, I think basically he's looking for some functionality similar to what I did in my own install of PrettyURLs (http://nao.noisen.com for instance) -- having topic IDs in the URL so that the topic can always be found, regardless of the topic name in the URL (it's only there for... a pretty and informative URL.) Additionally, it saves some time to make a search on the topic ID rather than the cached name. Two pros and only one con (slightly longer URL).
In any case, it's easy to implement.
That's exactly what I did with SimpleSEF... definitely helps vs having to do a search for name.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

dotch

This question seems to be simple, but I can't find the answer.
I've deleted a message on my forum. This message was drawing traffic from external links on the Internet. The link to the deleted post looked like this:

http://www.myforum.com/smf/thisboard/my-old-topic-which-i-deleted/

I rewrote the message and posted it again with exactly the same message title. Now the link looks like this:

http://www.myforum.com/smf/thisboard/my-old-topic-which-i-deleted-743/

If I click on the old link this message appears:

Warning!
The topic or board you are looking for appears to be either missing or off limits to you.
Please login below or register an account with MyFforum.com.


I want to redirect the old link to the new message. I've tried to ad this line to the .htaccess file in the main smf folder (as I use to do with an other old html-site):

Redirect 301 smf/thisboard/my-old-topic-which-i-deleted/ http://www.myforum.com/smf/thisboard/my-old-topic-which-i-deletded-743/

But this did not work. What can I do to redirect the traffic to the new message?









vbgamer45

Do you have a recycle bin for your forum? That could explain since the url was already in the cache to append to the id to the topic

Make sure your .htaccess rule is near the top above the pretty urls rules
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

dotch

Quote from: vbgamer45 on January 30, 2010, 06:30:08 PM
Do you have a recycle bin for your forum? That could explain since the url was already in the cache to append to the id to the topic

No recycle bin. As far as I know, SMF 1.1x does not have this feature. SMF 2.x

Quote
Make sure your .htaccess rule is near the top above the pretty urls rules

hmmm, now I get something like this:

http://www.myforum.com/smf/thisboard/my-old-topic-which-i-deleted-743/?pretty;board=thisboard;topic=my-old-topic-which-i-deleted.0


vbgamer45

Can you post a copy of your .htaccess file?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

dotch

Quote from: vbgamer45 on January 30, 2010, 06:59:31 PM
Can you post a copy of your .htaccess file?

Here is the original .htaccess file:


# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: January 30, 2010, 23:28

RewriteEngine on

# Rules for: tp-articles
RewriteRule ^page/([^/]+)/?$ ./index.php?pretty;page=$1 [L,QSA]

# Rules for: actions
RewriteRule ^(activate|admin|announce|arcade|managegames|arcadecategory|arcadesettings|ban)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(boardrecount|buddy|calendar|cleanperms|collapse|convertentities|convertutf8|coppa)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(contact|deletemsg|detailedversion|display|dlattach|dumpdb|editpoll|editpoll2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(featuresettings|featuresettings2|findmember|help|gallery|helpadmin|im|jsoption)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(jsmodify|lock|lockVoting|login|login2|logout|maintain|manageattachments)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(manageboards|managecalendar|managesearch|markasread|membergroups|mergetopics|mlist|modifycat)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(modifykarma|modlog|movetopic|movetopic2|news|notesave|notify|notifyboard)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(optimizetables|packageget|packages|permissions|pgdownload|pm|post|post2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(postsettings|printpage|profile|profile2|quotefast|quickmod|quickmod2|recent)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(regcenter|register|register2|reminder|removemodified|removetopic2|removeoldtopics2|removepoll)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(repairboards|reporttm|reports|requestmembers|search|search2|sendtopic|serversettings)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(serversettings2|sitemap|smileys|smstats|spellcheck|splittopics|stats|sticky)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(theme|trackip|xlinks|admod|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(viewErrorLog|viewmembers|viewprofile|verificationcode|vote|viewquery|who|\.xml)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(tpadmin|forum|tpmod)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

Imago

Hello,

Excellent job. Congratulations!

Could you please tell me why the names of the topics are correctly transcribed from Russian to Latin, while the names of the Boards are not - most of the letters are omitted. Instead of hronika I get oka

Thank you


raing3

Quote from: raing3I was hoping that there was a simple PHP script which could help with the replacing of Pretty URLs with their respective original URLs in posts and possible PMs and signatures.

I have given it a quick go at writing a script but I failed. The reason I wish for such a script is because I regularly clean out the pretty URLs cache so that URLs can be regenerated for when topics are renamed or moved between boards, doing so causes links to the previous URLs on the forum to become inaccessible.

This would also come in handy as I am considering using SimpleSEF instead of Pretty URLs as it uses the topic id/board id etc. as part of the links so when the name of the topic/board etc. changes all previous links still remain valid.

Thanks for any time and help, I already checked the troubleshooting page and their doesn't seem to be any information about this.

To further explain myself from my previous post...

I would like a script which would just go through the posts, signature and PMs and  replace this example URL http://www.simplemachines.org/community/modifications-and-packages/pretty-urls-1.0rc/ with http://www.simplemachines.org/community/index.php?topic=146969. Obviously repeat with all the rows in the PrettyURL cache table.

This clearly wouldn't fix any problems with people linking to the topic from external URLs but the main issue I am concerned about is internal links on the forum.

I wish to do this because I plan on giving SimpleSEF a go for a while and simply uninstalling PrettyURLs with render quite a number of URLs invalid.

Thanks.

Dannii

Install the reverter package.
"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."

anakmacan

I messed up my htaccess (smf 1.1.11) last time so i copied my other forum htaccess (smf 2.0 RC2) and pasted it into the other htaccess (1.1.11), and strangely the problem's solved. Here's my rc2 htaccess file if someone want to try to copy paste it, just incase it helps!!

# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: January 29, 2010, 8:50

RewriteEngine on
RewriteBase /

# Rules for: profiles
RewriteRule ^profile/([^/]+)/?$ ./index.php?pretty;action=profile;user=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# PRETTYURLS MOD ENDS


Dannii

Go add the language entry to modifications.english.php yourself. :)
"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."

vbgamer45

Maddog my guess for some of those errors you have your language is set to English-utf8 go to Admin -> Server Settings and under language make sure it is set to just English.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: