2
   

SEO Mod - Keywords in URL String?

 
 
Reply Tue 25 May, 2004 09:27 pm
I would like to adjust your mod to contain keywords in the URL string for guests. For example, instead of:

website.org/forum-1.html

I would like to have:

website.org/forum-1-keyword1-keyword2-keyword3.html

Google loves keywords in the URL string, so this could be dynamite. I already tested this with static keywords, and it works. However, I need help with implementing dynamic keywords.

Somehow I need to adjust the replace_for_mod_rewrite function in the page_header.php file to include {PAGE_TITLE}. If {PAGE_TITLE} was passed to this function, I could manipulate it like this:

*** Code assumes {PAGE_TITLE} is passed to replace_for_mod_rewrite function as $page_title ***

//separates $page_title into separate keywords
$keyword_array = explode(" ", $page_title);

//takes URL unfriendly characters out of keywords
for ($j=0; $j<count($keyword_array); $j++)
{
$patterns = array(";", "@", "?", ":", "=", "&",
"<", ">", '"', "#", "[", "]",
"%", "{", "}", "|", "^", "~",
"/", "\\", "`", "$");

$replacements = "";
$keyword_array[$j] = str_replace($patterns, $replacements, $keyword_array[$j]);
}

//Glues the keywords back together, separated by dashes
$keyword_string = implode("-", $keyword_array);

Then within the $urlout array, the keyword string would be part of the replacement like this:

$urlout = array(
forum-\\1-$keyword_string.html
);

I was hoping someone could help me who knows much more than me about the framework of PHPBB and the SEO mod. Thanks a lot!!!
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 2 • Views: 14,257 • Replies: 28
No top replies

 
Craven de Kere
 
  1  
Reply Wed 26 May, 2004 01:32 am
I might be able to work on keyword URLs in the future but right now I'm too busy.

I might have more time in about 2-4 weeks.

From a quick glance at your code, what I'd change is to not make the title an array of words and just str_replace the spaces with dashes.

But then again maybe I'd use the array to create dynamic keyword meta tags...

Lots of possibilities, I'll definitely tackle this sometime, but hopefully someone else will get to it before then. Google really does like URL words and it's a good idea.
0 Replies
 
strum4life
 
  1  
Reply Wed 26 May, 2004 03:03 am
Thanks
Thanks for the response and suggestions. I think I'm close to figuring this out, so I will let you know how it goes in case you would like to include it in your next version.
0 Replies
 
strum4life
 
  1  
Reply Wed 26 May, 2004 09:43 am
Keywords in URL's
I don't know what I was talking about with wanting the Page Title in the link. I completed this, and I realized this is not what I was looking for at all.

However, I started to change my index page, and now my forum links from the index page have keywords in the URL. If you would like to see this in action, go to extremeblitz.com/forum/. Here is my code so far, I was wondering if you could glance at it and pick out anything that's inefficient:

OPEN index.php

FIND
$template->assign_block_vars('catrow.forumrow', array(

Before, ADD
if ( !$userdata['session_logged_in'] )
{
$forum_name = $forum_data[$j]['forum_name'];
$forum_url_keywords = strtolower($forum_name);
$forum_url_keywords = preg_replace("/[^A-Za-z0-9 -]/", "", $forum_url_keywords);
$forum_url_keywords = str_replace(" ", "-", $forum_url_keywords);
$forum_url_keywords = "-$forum_url_keywords.html";
}

FIND
'FORUM_NAME' => $forum_data[$j]['forum_name'],

After, ADD
'FORUM_URL_KEYWORDS' => $forum_url_keywords,

FIND
'FORUM_NAME' => $forum_data[$j]['forum_name'],

REPLACE WITH
'FORUM_NAME' => $forum_name,


OPEN index_body.tpl

FIND
<a href="{catrow.forumrow.U_VIEWFORUM}

After, ADD
{catrow.forumrow.FORUM_URL_KEYWORDS}

OPEN page_header.php

FIND
"forum-\\1.html",

REPLACE WITH
"forum-\\1",
0 Replies
 
Craven de Kere
 
  1  
Reply Wed 26 May, 2004 11:05 am
It's looking good. What code are you using for the viewforum files?

I might get a chance to tidy it up shortly seeing as you have some code to work off of.

What I need to do is research any other charachters that might be URL unfriendly and/or redo the .htaccess rewrite rules.
0 Replies
 
strum4life
 
  1  
Reply Wed 26 May, 2004 03:58 pm
View Forum
Here are my changes for the viewforum page. By the way, I changed the code so that only alphanumeric characters are allowed in the URL string.

OPEN viewforum.php

FIND
$topic_title = ( count($orig_word) ) ? preg_replace......

After, ADD
if ( !$userdata['session_logged_in'] )
{
$topic_url_keywords = strtolower($topic_title);
$topic_url_keywords = preg_replace("/[^A-Za-z0-9 -]/", "", $topic_url_keywords);
$topic_url_keywords = str_replace(" ", "-", $topic_url_keywords);
$topic_url_keywords = "-$topic_url_keywords.html";
}

FIND
'TOPIC_TITLE' => $topic_title,

After, ADD
'TOPIC_URL_KEYWORDS' => $topic_url_keywords,

OPEN viewforum_body.tpl

FIND
<a href="{topicrow.U_VIEW_TOPIC}

After, ADD
{topicrow.TOPIC_URL_KEYWORDS}

OPEN page_header.php

FIND
"about\\1.html",

REPLACE WITH
"topic-\\1",

OPEN .htaccess

FIND
RewriteRule ^about([0-9]*).* viewtopic.php?t=$1 [L,NC]

REPLACE WITH
RewriteRule ^topic-([0-9]*).* viewtopic.php?t=$1 [L,NC]
0 Replies
 
Craven de Kere
 
  1  
Reply Wed 26 May, 2004 04:07 pm
Looks good, you inadvertently took care of one of the problems I'd planned to address.

Test topics with "topic" and "topic-" in the title and see if they are rewritten correctly on your test board.
0 Replies
 
LocanT
 
  1  
Reply Tue 1 Jun, 2004 06:15 am
Strum4life

Is this mod 100% ready to go?

As it would be surely be a great addition

One other quick question!

Regarding pictures on a forum! will search engines bots pick them up and go to the site of origin just like a normal link?
0 Replies
 
Craven de Kere
 
  1  
Reply Tue 1 Jun, 2004 09:17 am
Locan,

No, it's not ready.

strum4life,

BTW, you are getting errors on forums with multiple pages.
0 Replies
 
erth
 
  1  
Reply Mon 13 Sep, 2004 02:00 pm
Any status on this feature request?

Or is it worked into another thread already.

I know that Google give large weight to keywords in urls, especially file names rather than directories.
0 Replies
 
qwerky
 
  1  
Reply Sun 5 Dec, 2004 07:59 am
I really like this mod, thanks for bringing it out

it seems v close to being a perfect solution

i get these urls

forum/about1.html for forum

and

forum/about1.html%20-this%20is%20my%20post.html for posts

am i doing something wrong or is it supposed to work like this?

It seems like this mod is trying to do something like this

forum/about1/ for forum

and this

forum/about1/this-is-my-post.html for post

not sure what I am doing wrong but any guidance would be much appreciated
0 Replies
 
protesto
 
  1  
Reply Fri 4 Mar, 2005 06:33 am
qwerky wrote:
I really like this mod, thanks for bringing it out

it seems v close to being a perfect solution

i get these urls

forum/about1.html for forum

and

forum/about1.html%20-this%20is%20my%20post.html for posts

am i doing something wrong or is it supposed to work like this?

It seems like this mod is trying to do something like this

forum/about1/ for forum

and this

forum/about1/this-is-my-post.html for post

not sure what I am doing wrong but any guidance would be much appreciated


I don't know if it's your mod or not but a new rewrite mod using keywords is ready to use:
http://www.phpbbhacks.com/download/4702

But the problem is, I already use able2know mod_.rewrite. If I'll use this new mod, all my URL's will be replaced with these new keyword rich URL's. The pages, which are indexed by google, will be not accessable anymore. How can we prevent this?
0 Replies
 
993ti
 
  1  
Reply Fri 4 Mar, 2005 03:53 pm
Using this on my site now and it works great, thx! :wink:
0 Replies
 
jseamless
 
  1  
Reply Sat 5 Mar, 2005 01:29 pm
I would very much like to know how to make the keyword mod_rewrite work while still keeping the old urls in search engine's alive.
0 Replies
 
protesto
 
  1  
Reply Mon 7 Mar, 2005 12:19 am
jseamless wrote:
I would very much like to know how to make the keyword mod_rewrite work while still keeping the old urls in search engine's alive.


This was exactly what I ment.
0 Replies
 
993ti
 
  1  
Reply Tue 8 Mar, 2005 08:39 am
Links from results are still working for me :wink:
0 Replies
 
protesto
 
  1  
Reply Wed 9 Mar, 2005 01:24 am
993ti wrote:
Links from results are still working for me :wink:


Are you still using both of the mods together?

Can you post the code changes that you've made? I've applied the new keyword mod without removing able2know's mod, but the new one did not work.
0 Replies
 
993ti
 
  1  
Reply Thu 10 Mar, 2005 10:30 am
I'm using Craven's rewrite with the mod posted in this topic.
If you're using Webmedics rewrite, uninstall Cravens but leave the code in htaccess.
0 Replies
 
protesto
 
  1  
Reply Thu 10 Mar, 2005 12:03 pm
I did exactly what you wrote, but it didn't work Sad
0 Replies
 
mysticalwonders
 
  1  
Reply Tue 22 Mar, 2005 12:50 pm
looks like an interesting topic.. hopefully we can get some input on this
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » SEO Mod - Keywords in URL String?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/26/2024 at 06:50:35