[MODDB] Search Engine Friendly (SEO) URLs 1.0.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
oscar alexander
Registered User
Posts: 7
Joined: Tue May 29, 2007 4:56 pm

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by oscar alexander »

GP, could you give me a heads up on the new format you're rewriting to? Like I said earlier, I think it would be *really* cool to have URLs like:

/forums/ <= forum index
/forums/123-some-forum/ <= topic index
/forums/123-some-forum/456-some-topic/ <= topic messages
/forums/123-some-forum/456-some-topic/2/ <= page 2 of topic messages
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by Handyman` »

oscar alexander wrote:GP, could you give me a heads up on the new format you're rewriting to? Like I said earlier, I think it would be *really* cool to have URLs like:

/forums/ <= forum index
/forums/123-some-forum/ <= topic index
/forums/123-some-forum/456-some-topic/ <= topic messages
/forums/123-some-forum/456-some-topic/2/ <= page 2 of topic messages
My new version does that 8-)
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
TheInvisible
Registered User
Posts: 25
Joined: Thu May 31, 2007 2:10 pm

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by TheInvisible »

On localhost it doesn't work too.
Sorry of my nationals but many Polish are cool people. :)
ecwpa
Registered User
Posts: 107
Joined: Thu Sep 25, 2003 2:13 am
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by ecwpa »

i tried the code oscar posted with a little variation

topic name: AEIOU , ÁÉÍÓÚ

Code: Select all

function format_url($url)
{
   $url = htmlentities(strtolower($url));
   $url = preg_replace("/&([a-z])(uml|acute|grave|circ|tilde|cedil|ring);/", '$1', $url);
   $url = preg_replace('/([^a-z0-9]+)/', '-', html_entity_decode($url));

        $url = "-{$url}.html";
        return utf8_clean_string($url);
}
this one replace all "rare" chars with a "-" like:

f11t2371-aeiou-.html

Code: Select all

function format_url($url) {
    $url =  htmlentities($url);
    $url = preg_replace('/&([a-z])(uml|acute|grave|circ|tilde|cedil|ring);/i', '$1', $url);
    $url = "-{$url}.html";
    return html_entity_decode($url);
}
and this one returns something like:

f11t2371-AEIOU%20,%20A%EF%BF%BDA%EF%BF%BDA%EF%BF%BDA%EF%BF%BDA%EF%BF%BD.html


as a suggestion, a pretty nice format would be:

forums/f1/forum-name/ - first forum
forums/f1/ - first forum "unique" seo url

forums/f1/forum-name/t1/topic-title/ - first topic
forums/f1/forum-name/t1/ - first topic "unique" seo url
forums/f1/t1/ - first topic "unique" super short seo url

actually, i cant put whatever in the topic-title or forum-name part of the string and i should work, but if you remove it, it doesnt

nice mod anyways! thanks!
carefull, not english speaker native here
TheInvisible
Registered User
Posts: 25
Joined: Thu May 31, 2007 2:10 pm

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by TheInvisible »

now i have 403 :) i dont know what must i do... help :)
Sorry of my nationals but many Polish are cool people. :)
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by Handyman` »

TheInvisible wrote:now i have 403 :) i dont know what must i do... help :)
if it doesn't work on your localhost, either you didn't install the .htaccess section correctly, or you don't have a server with mod_rewrite enabled.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by Handyman` »

ecwpa, I'll figure something out.
You'll like it :)
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
TheInvisible
Registered User
Posts: 25
Joined: Thu May 31, 2007 2:10 pm

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by TheInvisible »

GroovePlugs wrote:if it doesn't work on your localhost, either you didn't install the .htaccess section correctly, or you don't have a server with mod_rewrite enabled.
On localhost and on each other server it doesn't work, mod_Rewrite works corectly becouse on the same server I have much more websites which are using mod_rewrite, if you wanna to check one of them is: if you wanna you can ping or check tracerout that and http://forum.e-medycyna.org :)
My .htaccess is

Code: Select all

RewriteEngine on

## These rules are for the SIDs
RewriteRule ^s([0-9]*)f([0-9]*)t([0-9]*)-(.+).html-(.+) ./viewtopic.php?f=$2&t=$3&start=$1&$5
RewriteRule ^f([0-9]*)t([0-9]*)-(.+).html-(.+) ./viewtopic.php?f=$1&t=$2&$4
RewriteRule ^f([0-9]*)-(.+).html-(.+) ./viewforum.php?f=$1&$3

## These rules have no use for SIDs
RewriteRule ^s([0-9]*)f([0-9]*)t([0-9]*)-(.+).html ./viewtopic.php?f=$2&t=$3&start=$1
RewriteRule ^f([0-9]*)t([0-9]*)-(.+).html ./viewtopic.php?f=$1&t=$2
RewriteRule ^f([0-9]*)-(.+).html ./viewforum.php?f=$1
Last edited by TheInvisible on Mon Jun 04, 2007 5:02 pm, edited 1 time in total.
Sorry of my nationals but many Polish are cool people. :)
oscar alexander
Registered User
Posts: 7
Joined: Tue May 29, 2007 4:56 pm

Re: [BETA] Search Engine Friendly (SEO) URLs

Post by oscar alexander »

GroovePlugs wrote:My new version does that 8-)
OMG. I want your babies!
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by Handyman` »

You may now have it 8-)
Beta 7 released.

Character replacement is in effect 8-)

See first post for download
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
oscar alexander
Registered User
Posts: 7
Joined: Tue May 29, 2007 4:56 pm

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by oscar alexander »

Awesome job! I'm waiting for the official phpBB3 release before I start working with it (since I plan to design an entirely new, simplified temlate set), but I will definitely implement your mod. Thanks :D

Perhaps it would be a nice idea to provide the modified files as well?
Last edited by oscar alexander on Sat Jun 02, 2007 11:09 am, edited 1 time in total.
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by Handyman` »

no pre-modded files are allowed here… forum rules.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
ecwpa
Registered User
Posts: 107
Joined: Thu Sep 25, 2003 2:13 am
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by ecwpa »

the function file name is functions_short_urls.php right? i had to change the name

well, its a bit strange, i have a forum called "discución general", topic: "URL's cortas óóóóóóóóóÚÚÚÚ UUU ÓÓ $"

f1-discusiy%EF%BF%BDn-general/t2370-url's-cortas-y%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDyoyoyoyo-uuu-yeye-$.html
the other thing is that index and viewforum are ok but viewtopic for some strange reason looks like there is no css, all in white with no style, i checked the changes for the theme files but it doesnt seems to modify any css related thing
carefull, not english speaker native here
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by Handyman` »

ecwpa wrote:the function file name is functions_short_urls.php right? i had to change the name

well, its a bit strange, i have a forum called "discución general", topic: "URL's cortas óóóóóóóóóÚÚÚÚ UUU ÓÓ $"

f1-discusiy%EF%BF%BDn-general/t2370-url's-cortas-y%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDy%EF%BF%BDyoyoyoyo-uuu-yeye-$.html
the other thing is that index and viewforum are ok but viewtopic for some strange reason looks like there is no css, all in white with no style, i checked the changes for the theme files but it doesnt seems to modify any css related thing
Make sure you ran the edits in prosilver.txt and subsilver2.txt… then when you are finished, refresh the template in the ACP… then you should be good to go.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
User avatar
Handyman`
Former Team Member
Posts: 1751
Joined: Thu Feb 03, 2005 8:44 pm
Contact:

Re: [BETA] Search Engine Friendly (SEO) URLs 1.0.0 Beta 7

Post by Handyman` »

I made a small error in the instructions that would have kept things from working.

in functions.php, it said to add

Code: Select all

include('seo_urls.' . $phpEx);  
it should be

Code: Select all

include('functions_seo.' . $phpEx);  
Download is updated with the fix.
http://startrekguide.com My Mod Queue || 1/16/10 Display Posts Anywhere 1.2.0 RC5, Cash MOD 1.0.0 b1, MOD Version Check, AJAX Chat, SEO MOD, AJAX QR, Photo Gallery
MOD Development Manager (version 0.2.0-dev with MODX Generator)
Locked

Return to “[3.0.x] MODs in Development”