1
Anonymous
Story title in url address hack
  • 2008/4/26 16:49

  • Anonymous

  • Posts: 0

  • Since: 0


Hi,

A very usefull thing for SEO-ing your website is having story title or keywords in urls. so I made small hack to add story title in url address.

Example:
http://www.arabxoops.com/modules/news/article.php?storyid=17/XOOPS%20Foundations%20Announcement

Edit modules/news/class/class.newsstory.php and find:

le="color: #000000"><?php $story['title'] = "<a href='".XOOPS_URL."/modules/news/article.php?storyid=".$this->storyid()."'".$story['infotips'].">".$this->title()."</a>";


replace it with:

le="color: #000000"><?php $story['title'] = "<a href='".XOOPS_URL."/modules/news/article.php?storyid=".$this->storyid()."/".$this->title()."'".$story['infotips'].">".$this->title()."</a>";




2
trabis
Re: Story title in url address hack
  • 2008/4/27 0:19

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Should provide a function to clean the title a little, special chars, spaces... You can look at modules using seo for that. I´m not shure but maybe the last news version has that function some where.

To be honest here, I don´t know if that SEO-ing thing is true.
I believe in friendly urls because they can influence the user to click and not because the search engines will up your rank.
I´m not shure if i can even consider your example as a friendly url.

Just my opinion, anyway, thanks for sharing this.

3
aponal
Re: Story title in url address hack
  • 2008/5/17 8:25

  • aponal

  • Just popping in

  • Posts: 9

  • Since: 2007/7/9 2


hhttp://www.buyuk-tire.com/news-index.htm


http://www.buyuk-tire.com/konu-1-Tirehaber/
http://www.buyuk-tire.com/news-archive.year-2008-month-5.htm

http://www.buyuk-tire.com/haber-48-tire’li-hanimlar-hasir-ormeyi-seviyor/

$story->title = str_replace(" ","-",$story->title);

mainfile.php

<?php $GLOBALS['_rewriteRulesFrom'] = array( '/forum/', '/haber-', '/konu-', '/arsiv-', ); $GLOBALS['_rewriteRulesTo'] = array( '/modules/newbbex/', '/modules/news/article.php?storyid=', '/modules/news/index.php?storytopic=', '/modules/news/print.php?storyid=', ); $GLOBALS['_abs_offset'] = preg_replace('/https?://'.$_SERVER["HTTP_HOST"].'/','',XOOPS_URL); $GLOBALS['_rewriteRulesTo1'] = preg_replace('/^(.*)$/e','"!('.XOOPS_URL.'|"".$GLOBALS["_abs_offset"]."|'".$GLOBALS["_abs_offset"].")".preg_quote("1","!")."!"', $GLOBALS['_rewriteRulesTo']); $GLOBALS['_rewriteRulesFrom1'] = preg_replace('/^(.*)$/','\11',$GLOBALS['_rewriteRulesFrom']); function modul_turkcelestirici( $s ) { $s = preg_replace($GLOBALS['_rewriteRulesTo1'],$GLOBALS['_rewriteRulesFrom1'], $s); while($i<=count($GLOBALS['_rewriteRulesFrom'])) { $s = preg_replace( '/('.preg_quote(XOOPS_URL,'/').'|"|')'.preg_quote($GLOBALS['_rewriteRulesTo'][$i],'/').'/' ,"\1".$GLOBALS['_rewriteRulesFrom'][$i] , $s ) ; $i++; } return $s; } if (empty($_SERVER['REDIRECT_URL']) || ($_SERVER['REDIRECT_URL'] == $_SERVER['REQUEST_URI'])) { if (empty($_SERVER['REDIRECT_REDIRECT_STATUS'])) { if (($_changer_url=modul_turkcelestirici('"'.$_SERVER['REQUEST_URI'].'"')) != '"'.$_SERVER['REQUEST_URI'].'"') { header('Location: ' . str_replace('"','',$_changer_url)); } } } $_SERVER['REQUEST_URI'] = str_replace( $GLOBALS['_rewriteRulesFrom'],$GLOBALS['_rewriteRulesTo'], @$_SERVER['REQUEST_URI'] ) ; $_SERVER['HTTP_REFERER'] = str_replace($GLOBALS['_rewriteRulesFrom'], $GLOBALS['_rewriteRulesTo'], @$_SERVER['HTTP_REFERER'] ) ; ob_start( 'modul_turkcelestirici' ) ;


.htaccess

le="color: #000000"><?php RewriteEngine on RewriteRule ^konu-(.*)$ modules/news/index.php?storytopic=$1 [L] RewriteRule ^haber-(.*)$ modules/news/article.php?storyid=$1 [L] RewriteRule ^arsiv-(.*)$ modules/news/print.php?storyid=$1 [L]



örnek - example : 1

$this->keywords = str_replace(" ","-",$this->keywords);




$story['title'] = "<a href='".XOOPS_URL."/modules/news/article.php?storyid=".$this->storyid()."/".$this->keywords()."'".$story['infotips'].">".$this->title()."</a>";

.............

örnek - example : 2


$this->title = str_replace(" ","-",$this->title);


$story['title'] = "<a href='".XOOPS_URL."/modules/news/article.php?storyid=".$this->storyid()."/".$this->title()."'".$story['infotips'].">".$this->title()."</a>";


example str_replace 1

$story->title = str_replace('ç','c',$story->title);
$story->title = str_replace('Ç','c',$story->title);

example str_replace 2



$this->keywords = str_replace ("ç","c",$this->keywords);
$this->keywords = str_replace ("?","g",$this->keywords);
$this->keywords = str_replace ("?","i",$this->keywords);

..............

result

news seo



Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!