IPB

Welcome Guest ( Log In | Register )

[developer Guide] Furl Rule System

This topic is about [developer Guide] Furl Rule System, the author, bramburn, wrote about: Hi all, Due to the recent changes made to MinervaSEO 0.0.4 ALPHA it was wise for me to introduce a smart FURL system and to write a guide on how to use it. Why can't I edit it in the admincp? The ... To read more just scroll down

> Report bugs here!

Hey all!
Please report all bugs and errors to our iptracker it will be much more organised!

2 Pages V   1 2 >  
Reply to this topicStart new topic
[developer Guide] Furl Rule System, An important guide to help you customise the furl system on minervaseo
bramburn
post Jul 28 2007, 03:12 PM
Post #1


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



Hi all,
Due to the recent changes made to MinervaSEO 0.0.4 ALPHA it was wise for me to introduce a smart FURL system and to write a guide on how to use it.

Why can't I edit it in the admincp?
The reason to why you cannot edit the furl settings in the admincp is because people tend to edit the settings in the middle of a boards life time which results in broken links and lost of pagerank.
Initially mseo was going to hold the ability to enable users to edit the Friendly URL settings but as the url fixing mechanism is still not in place.

The rules are found in seo_settings.php
All you have to do to format them is edit the settings in that file

The current rules

These are the current applied rules that are built in mseo:

$topic_rule
This rule is for any link with showtopic= string in the url
The rule can contain:
  • $forum_id
  • $forum_title
  • $topic_id
  • $topic_title

$topic_multipage_rule

This rule is for any link with showtopic= and st= string in the url
The rule can contain:
  • $forum_id
  • $forum_title
  • $topic_id
  • $topic_title
  • $topic_st
$forum_rule
This rule is for any link with showforum= string in the url
The rule can contain:
  • $forum_id
  • $forum_title
$forum_multipage_rule
This rule is for any link with showforum= and st= string in the url
The rule can contain:
  • $forum_id
  • $forum_title
  • $forum_st

$showuser_rule
This rule is for any link with showuser= string in the url
The can contain:
  • $user_id
  • $user_title
Rule information variable
Rule information variable are variable that can be use insde the rules as they contain information

The current format
The current format of the rules are as follows:
<%rule_var%> = array(<%parser-to-matches%>, <%format-the-url%>, <%processed-to%>);

Example:
QUOTE
$forum_rule = array(
'forum/([0-9]+)/(.*?)/ ,
'forum/$forum_id/$forum_title/',
'showforum=$matches[1]'
);


Breakdown:
<%parser-to-matches%> :
This is for the preg_match check via php.
If you are not a guru in regex then just follow this basic rule:
If the information is a number use ([0-9]+) and if it is text or any other character use (.*?)

Here is a table to use to help you
$topic_id => ([0-9]+)
$topic_title => (.*?)
$topic_st => ([0-9]+)
$forum_id => ([0-9]+)
$forum_title => (.*?)
$forum_st => ([0-9]+)
$user_id => ([0-9]+)

<%format-the-url%>:
This tells the system what the url should hold and fill.


<%processed-to%>:
This one is a big complicated to some.
These:
showforum=$matches[1]&st=$matches[3]
showforum=$matches[1]
showtopic=$matches[1]&st=$matches[3]
showtopic=$matches[2]
showuser=$matches[1]

Always stay the same format except from the numbers in the brackets. as they need to match the information from <%format-the-url%>.

Here is a another table to help you understand which information is needed and what needs to come first

$showuser_rule => $user_id
$forum_rule => $forum_id
$forum_multipage_rule => $forum_id and then $forum_st
$topic_rule => $topic_id
$topic_multipage_rule => $topic_id and then $topic_st

This will be explained a little more when I try to teach you how to make your own urls.

Making your own URL
topic page only (example)
The rule for only the topic page is $topic_rule

Here is the default rule:
CODE
$topic_rule = array(
     'content/(.*?)/([0-9]+)/(.*?)/' ,
     'content/$forum_title/$topic_id/$topic_title/',
     'showtopic=$matches[2]' );


Now before we want to touch anything we have to decide how we want to present it.
Let's say you want something like the following using only topic id and topic title. Thus we are using $topic_id and $topic_title

CODE
http://testforum.com/topic-id-2563-this-is-the-title/


So now that I know I have this format I am going to start writing up my <%format-the-url%>

so I put topic-id-2563-this-is-the-title/ in <%format-the-url%> for $topic_rule
and replace the id with $topic_id and the title with $topic_title.

Hence:
CODE
topic-id-[b]$topic_id[/b]-[b]$topic_title[/b]/


Now we have this in the final array:
CODE
$topic_rule = array(
      <%parser-to-matches%>,
     'topic-id-[b]$topic_id[/b]-[b]$topic_title[/b]/',
     'showtopic=$matches[2]' );


Now we are going to work with <%parser-to-matches%> So we take topic-id-$topic_id-$topic_title/ and replace it with the table above and we get the following result which we then add to the final array rule:

topic-id-([0-9]+)-(.*?)/

Don't forget to add a $ sign at the end it tells the script that its finished

Hence the final array:
CODE
$topic_rule = array(
       'topic-id-[b]([0-9]+)[/b]-[b](.*?)[/b]/[color="#ff0000"]$[/color]',
      'topic-id-[b]$topic_id[/b]-[b]$topic_title[/b]/',
      'showtopic=$matches[2]' );


Now to understand the <%processed-to%> entry reference the above table that explains <%processed-to%>
So to do that entry we look at our <%format-the-url%> which is in this case
CODE
topic-id-[b]$topic_id[/b]-[b]$topic_title[/b]/

and see where $topic_id comes up in the string. As we can see it comes up as the first information variable so we are going to use 1 in showtopic=$matches[2]

Hence our final code:

CODE
$topic_rule = array(
        'topic-id-[b]([0-9]+)[/b]-[b](.*?)[/b]/' ,
       'topic-id-[b]$topic_id[/b]-[b]$topic_title[/b]/',
       'showtopic=$matches[1]' );


Remember if you don't understand what's going on please ask and I will make you a custom url.

But for the ones who cannot wait here are some usable urls that you could use:

$topic_rule

example: http://forumsite.com/content/this-is-the-f...s-is-the-title/
CODE
$topic_rule = array(
    'content/(.*?)/([0-9]+)/(.*?)/' ,
    'content/$forum_title/$topic_id/$topic_title/',
    'showtopic=$matches[2]' );



example: http://forumsite.com/content/this-is-the-f...-the-title.html
CODE
$topic_rule = array(
     'content/(.*?)/([0-9]+)/(.*?).html' ,
     'content/$forum_title/$topic_id/$topic_title.html',
     'showtopic=$matches[2]' );


example: http://forumsite.com/topic-123-this-is-the-title/
CODE
$topic_rule = array(
     'topic-([0-9]+)-(.*?)/' ,
     'topic-$topic_id-$topic_title/',
     'showtopic=$matches[1]' );


example: http://forumsite.com/topic-123-this-is-the-title.html
CODE
$topic_rule = array(
      'topic-([0-9]+)-(.*?).html' ,
      'topic-$topic_id-$topic_title.html',
      'showtopic=$matches[1]' );


example: http://forumsite.com/topic-this-is-the-title-t123.html
CODE
$topic_rule = array(
       'topic-(.*?)-t([0-9]+).html' ,
       'topic-$topic_title-t$topic_id.html',
       'showtopic=$matches[2]' );



$topic_multipage_rule

example: http://forumsite.com/content/this-is-the-f...e-title/page/2/
CODE
$topic_multipage_rule = array(
     'content/(.*?)/([0-9]+)/(.*?)/page/([0-9]+)/' ,
     'content/$forum_title/$topic_id/$topic_title/page/$topic_st/',
     'showtopic=$matches[2]&st=$matches[4]' );



example: http://forumsite.com/content/this-is-the-f...tle/page/2.html
CODE
$topic_multipage_rule = array(
      'content/(.*?)/([0-9]+)/(.*?)/page/([0-9]+).html' ,
      'content/$forum_title/$topic_id/$topic_title/page/$topic_st.html',
      'showtopic=$matches[2]&st=$matches[4]' );


example: http://forumsite.com/topic-123-this-is-the-title-page-2/
CODE
$topic_multipage_rule = array(
      'topic-([0-9]+)-(.*?)-page-([0-9]+)/' ,
      'topic-$topic_id-$topic_title-page-$topic_st/',
      'showtopic=$matches[1]&st=$matches[3]' );


example: http://forumsite.com/topic-123-this-is-the-title-page-2.html
CODE
$topic_multipage_rule = array(
       'topic-([0-9]+)-(.*?)-page-([0-9]+).html' ,
       'topic-$topic_id-$topic_title-page-$topic_st.html',
       'showtopic=$matches[1]&st=$matches[3]' );


example: http://forumsite.com/topic-this-is-the-title-t123-p2.html
CODE
$topic_multipage_rule = array(
        'topic-(.*?)-t([0-9]+)-p([0-9]+).html' ,
        'topic-$topic_title-t$topic_id-p$topic_st.html',
        'showtopic=$matches[2]&st=$matches[3]' );


More to come....

This post has been edited by bramburn: Aug 2 2007, 10:57 AM


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
Kirk
post Aug 2 2007, 10:24 AM
Post #2


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



Thanks, also on your examples, take the last one your missing a little ' on each of them

CODE
$topic_multipage_rule = array(
      'topic-(.*?)-t([0-9]+)-p([0-9]+).html' ,
      'topic-$topic_title-t$topic_id-p$topic_st.html',
      'showtopic=$matches[2]&st=$matches[3]' );


Just wanted to point it out, had my wondering for a while tongue.gif
Go to the top of the page
 
+Quote Post
bramburn
post Aug 2 2007, 10:54 AM
Post #3


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



ooh snap thanks for that


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
localhost
post Aug 23 2007, 01:56 AM
Post #4


Newbie
*

Group: Members
Posts: 6
Joined: 21-August 07
Member No.: 36



I cant understand anything. I asked something to you bramburn, and you gave this topic to me.

But I dont understand anything here. I want to make all links which are in Board Index like ...com/forum/27/SCREENSHOTS/



What should I do?

Go to the top of the page
 
+Quote Post
bramburn
post Aug 23 2007, 06:40 AM
Post #5


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



enable furl in the admincp > tools and settings > mseo > general settings > enable furl


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
localhost
post Aug 23 2007, 12:13 PM
Post #6


Newbie
*

Group: Members
Posts: 6
Joined: 21-August 07
Member No.: 36



All the settings that contains "Enable" are already set to YES. Nothing different. :=(
Go to the top of the page
 
+Quote Post
localhost
post Aug 23 2007, 09:00 PM
Post #7


Newbie
*

Group: Members
Posts: 6
Joined: 21-August 07
Member No.: 36



Hey man, I need your help. unsure.gif
Go to the top of the page
 
+Quote Post
bramburn
post Aug 23 2007, 09:08 PM
Post #8


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



QUOTE(localhost @ Aug 23 2007, 09:00 PM) *
Hey man, I need your help. unsure.gif

what do you need done and what have you got so far?


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
localhost
post Aug 23 2007, 10:11 PM
Post #9


Newbie
*

Group: Members
Posts: 6
Joined: 21-August 07
Member No.: 36



As I showed you in the picture, when my cursor is over any Forum link in BoardIndex, the url that they have look like ?showforum=21 .. But when I click to it, the page url (address line of browser) that I had just transfered is being like forum/21/Clans/ .. I want href values of Forum links to be like forum/21/Clans , NOT LIKE : ?showforum=21 ..

Settins : Furl > ENABLED , Minerva SEO > ENABLED, and Include index.php in links? > YES
Go to the top of the page
 
+Quote Post
bramburn
post Aug 24 2007, 06:34 AM
Post #10


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



it seeems that there have been no edits to index.php or class_display.php

if you cannot find any issue could you zip those files and pm me them so that I can take a look at them.


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
dieselpowered
post Aug 27 2007, 04:55 AM
Post #11


Newbie
*

Group: Members
Posts: 7
Joined: 21-August 07
Member No.: 33



Is there any problems with taking out the text of 'content' or 'category' or 'topic' from the rules area?

I was getting urls like this:

http://www.utvwire.com/topic-Dune-sideXsides-t11.html

I removed 'topic-' to make the urls look like this, is this alright?

http://www.utvwire.com/Dune-sideXsides-t11.html
Go to the top of the page
 
+Quote Post
bramburn
post Aug 27 2007, 06:58 AM
Post #12


Administrator
***

Group: Root Admin
Posts: 904
Joined: 25-June 07
From: London
Member No.: 1



sure you can do what you want. just make sure that it does not look the same as any other furl rules smile.gif


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post
jikson26
post Sep 9 2007, 11:43 AM
Post #13


Newbie
*

Group: Members
Posts: 4
Joined: 9-September 07
Member No.: 55



$forum_rule
$forum_multipage_rule
$showuser_rule
$topic_view_getnewpost
$topic_view_getlastpost

Hi, Sorry to ask for so much, but can you make me FURLs for the above rules, that have endings of .html.

I would like them to look like this http://forumsite.com/topic-this-is-the-title-t123-p2.html

Anything that looks like a one-html file would be fine. I mean like no /folder/folder/folder/ type of thing.

If you could help, I would be very grateful! Thanks!!!
Go to the top of the page
 
+Quote Post
Kirk
post Sep 9 2007, 02:46 PM
Post #14


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



This is mine, does what you are looking for smile.gif

CODE

<?php
/**
* @package Minerva SEO (minervaseo.com)
* @author Bhavesh Ramburn, icelabz.net <nitr021@icelabz.net>
* @copyright 2007 icelabz.net, this is not an opensource software. Please see license section on minervaseo.com
*
*/

/**
* topic rule
*/

$topic_rule = array(
't-([0-9]+)-(.*?).html ,
't-$topic_id-$topic_title.html',
'showtopic=$matches[1]'
);

/**
* topic multi page rule
*/

$topic_multipage_rule = array(
't-(.*?)-t([0-9]+)-p([0-9]+).html ,
't-$topic_title-t$topic_id-p$topic_st.html',
'showtopic=$matches[2]&st=$matches[3]'
);

/**
* forum page rule
*/

$forum_rule = array(
'f-([0-9]+)/(.*?)/ ,
'f-$forum_id/$forum_title/',
'showforum=$matches[1]'
);

/**
* forum multi page rule
*/

$forum_multipage_rule = array(
'f-([0-9]+)/(.*?)/p/([0-9]+)/ ,
'f-$forum_id/$forum_title/p/$forum_st/',
'showforum=$matches[1]&st=$matches[3]'
);

/**
* user profile rules
*/

$showuser_rule = array(
'u-([0-9]+)/(.*?)/ ,
'u-$user_id/$user_title/',
'showuser=$matches[1]'
);

/**
* Topic View
*/

$topic_view_getnewpost = array(
'(.*?)/([0-9]+)/(.*?)/new/ ,
'$forum_title/$topic_id/$topic_title/new/',
'showtopic=$matches[2]&view=getnewpost'
);

/**
* Topic View
*/

$topic_view_getlastpost = array(
'(.*?)/([0-9]+)/(.*?)/last/ ,
'$forum_title/$topic_id/$topic_title/last/',
'showtopic=$matches[2]&view=getlastpost'
);
?>
Go to the top of the page
 
+Quote Post
jikson26
post Sep 10 2007, 07:36 AM
Post #15


Newbie
*

Group: Members
Posts: 4
Joined: 9-September 07
Member No.: 55



Yes, something similar. Thanks for the reply.

I Would like to make each forum like http://forumsite.com/f12.html

and like that.
Go to the top of the page
 
+Quote Post
Kirk
post Sep 11 2007, 04:12 PM
Post #16


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



QUOTE(jikson26 @ Sep 10 2007, 08:36 AM) *
Yes, something similar. Thanks for the reply.

I Would like to make each forum like http://forumsite.com/f12.html

and like that.


I tried doing something like that but I think that something that short isn't possible, it has to be a bit longer and if you contain the title of it rather than just the id, the bots/spiders will pick up on that easier smile.gif
Go to the top of the page
 
+Quote Post
bramburn
post Sep 14 2007, 02:55 PM
Post #17


Administrator
*