Pligg Tutorial: How to Remove the word category from Pligg’s category URL’s
This article could be considered a continuation of an article i wrote titled “Optimize your pligg site for better SEO with these guide tutorial instructions“, in that article i covered hypens vs underscores within pligg’s URL structure and supplied the code changes titled “Pligg Google SEO Friendly URL Rewrite Hack” along with my “Pligg Optimal Page Titles Hack” and “Pligg XML Google Sitemaps“. As you can tell from the content of the article i like SEO for Pligg and this article is no different as i show you how to optimize your pligg category url’s for a better SEO’d solution.
This article was born out of a comment on our blog posted by anil in response to the Pligg SEO article i wrote.
anil Says:
Hello guys,Have a site am using 2nd method url in pligg and the prob is
http://www.jeqq.com/category/news_technology_Appleits should be like ths
http://www.jeqq.com/category/news/technology/Appleor
like digg
http://www.digg.com/apple
But some of the devs told me its not possbile…will that effect my google rankings…
After reading anil’s comment it got me thinking why the word “category” was present within the url to beign with? which then led me onto trying to figure out a possible solution. So is this possible, the answer is yes. Will it affect your rankings in a bad way, the answer is no as long as you 301 redirect your old category url’s to the newly optimiized ones. Will it boost your rankings in search engine, i really cannot say for sure but it certainly won’t do any harm.
The first thing you need to know is that this pligg hack requires some code changes to the pligg codebase, i used v9.9.0 as our testing base.
Lets Begin
I will start off by explaining what this hack will acheive by showing an example of before and after :.
Original Published Category URL
http://yoursite.com/category/WorldNews
Optimized Published Categroy URL
http://yoursite.com/WorldNews
Original Upcoming Category URL
http://yoursite.com/upcoming/category/WorldNews
Optimized Upcoming Categroy URL
http://yoursite.com/upcoming/WorldNews
Sorts Bar url’s “Sort by:” are also affected
Original Sorts Published Category URL
http://yoursite.com/published/recent/category/WorldNews
Optimized Sorts Published Categroy URL
http://yoursite.com/published/recent/WorldNews
Original Upcoming Category URL
http://yoursite.com/upcoming/newest/category/WorldNews
Optimized Upcoming Categroy URL
http://yoursite.com/upcoming/newest/WorldNews
What You Will Need
1. Around 30mins to 1 hour of time to perform the code changes and test depending on experience.
2. Knowledge of how to 301 redirect URL’s with .htaccess if your pligg site is already live.
3. a computer haha
Code Changes
OPEN libs/html1.php
FIND
If ($x == "maincategory") {return my_pligg_base."/category/index.html" . $var1;}
If ($x == "queuedcategory") {return my_pligg_base."/upcoming/category/index.html" . $var1;}
If ($x == "discardedcategory") {return my_pligg_base."/discarded/category/index.html" . $var1;}
REPLACE WITH
If ($x == "maincategory") {return my_pligg_base."/index.html" . $var1;
}
If ($x == "queuedcategory") {return my_pligg_base."/upcoming/index.html" . $var1;} If ($x == "discardedcategory") {return my_pligg_base."/discarded/index.html" . $var1;}
OPEN libs/smartyvariables.php
FIND
$main_smarty->assign('index_url_recent', getmyurl('index_sort', 'recent', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('index_url_today', getmyurl('index_sort', 'today', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('index_url_yesterday', getmyurl('index_sort', 'yesterday', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('index_url_week', getmyurl('index_sort', 'week', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('index_url_month', getmyurl('index_sort', 'month', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('index_url_year', getmyurl('index_sort', 'year', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.$_GET['category']));
$main_smarty->assign('cat_url', getmyurl("maincategory"));
REPLACE WITH
$main_smarty->assign('index_url_recent', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/recent/index.html'.$_GET['category']));
$main_smarty->assign('index_url_today', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/today/index.html'.$_GET['category']));
$main_smarty->assign('index_url_yesterday', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/yesterday/index.html'.$_GET['category']));
$main_smarty->assign('index_url_week', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/week/index.html'.$_GET['category']));
$main_smarty->assign('index_url_month', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/month/index.html'.$_GET['category']));
$main_smarty->assign('index_url_year', getmyurl('index_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/year/index.html'.$_GET['category']));
$main_smarty->assign('cat_url', getmyurl("maincategory"));
OPEN /upcoming.php
FIND
$main_smarty->assign('upcoming_url_newest', getmyurl('upcoming_sort', 'newest', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_oldest', getmyurl('upcoming_sort', 'oldest', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_mostpopular', getmyurl('upcoming_sort', 'mostpopular', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_leastpopular', getmyurl('upcoming_sort', 'leastpopular', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/category/index.html'.sanitize($_GET['category'],2)));< $main_smarty->assign('cat_url', getmyurl("queuedcategory"));
REPLACE WITH
$main_smarty->assign('upcoming_url_newest', getmyurl('upcoming_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/newest/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_oldest', getmyurl('upcoming_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/oldest/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_mostpopular', getmyurl('upcoming_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/mostpopular/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('upcoming_url_leastpopular', getmyurl('upcoming_sort', '/pligg_tutorial_how_to_remove_the_word_category_from_pliggs_category_urls_20012008/leastpopular/index.html'.sanitize($_GET['category'],2)));
$main_smarty->assign('cat_url', getmyurl("queuedcategory"));
OPEN .htaccess
FIND
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
BELOW ADD
RewriteRule ^story/([0-9]+)/?$ story.php?id=$1 [L]
RewriteRule ^story/title/([a-zA-Z0-9-]+)/?$ story.php?title=$1 [L]
RewriteRule ^category/([^/]+)/?$ index.php?category=$1 [L]
RewriteRule ^upcoming/([^/]+)/?$ upcoming.php?category=$1 [L]
RewriteRule ^published/page/([^/]+)/?$ index.php?page=$1 [L]
RewriteRule ^published/page/([^/]+)/category/([^/]+)/?$ index.php?page=$1&category=$2 [L]
RewriteRule ^published/page/([^/]+)/([^/]+)category/([^/]+)/?$ index.php?page=$1?=$2&category=$3 [L]
RewriteRule ^upcoming/page/([0-9]+)/?$ upcoming.php?page=$1 [L]
RewriteRule ^upcoming/page/([^/]+)/category/([^/]+)/?$ upcoming.php?page=$1&category=$2 [L]
RewriteRule ^upcoming/page/([^/]+)/upcoming/([^/]+)/?$ upcoming.php?page=$1?=upcoming&order=$2 [L]
RewriteRule ^upcoming/page/([^/]+)/upcoming=([^/]+)category/([^/]+)/?$ upcoming.php?page=$1?=upcoming&order=$2&category=$3 [L]
That should be all the edits completed, clear your /cache and /templates_c folders and try it out.
Feel free to comment and for support please visit the forum topic How to Remove the word category from Pligg’s category URL’s
If you enjoyed this post, make sure you subscribe to our RSS feed!
Hi, it is great and it works if your language is english.
Can you give me a TIP how to do this in other language (or charset).
I am using Pligg version: 9.9.5 and it is UTF-8 and i can not make it work in bulgarian. I’ve made all the steps above and the URL is changed. But when i click on some link there is this notise – Opps, what you’re looking for isn’t here! so there is a problem .
It will be cool of someone have solution for that.
Thanks in advance.
Nikolai