|
SEO URLs for PHP-Fusion | Alpha Testing
|
| Ankur |
Posted on 17-07-2012 11:23
|

Admin

Posts: 1292
Joined: 02/11/2010
|
Hello Guyz,
I have Coded an Infusion which will provide you the ability to make your website URLs SEO Friendly. I hope that you will like it.
I tested it thoroughly but I think that people would test it more better.
Infusion Algorithm:
This infusion is based on REGEX/Regular Expression search.
1. Search for :
http://mysite.com/news.php?readmore={some number}
2. Replace it with :
http://mysite.com/News-{some number}-News-Description
3. Similarly do this for other URLs of Core.
Working:
As you know, it is quite impossible to implement it for all kind of URLs in the system, on basis of using Regex, you may find some little areas to be normal as they are in the system.
But I've tried my best to make each and every possible URL to be user friendly.
Testing and Reporting:
Currently, its Live Demo and Testing is done at : http://fusion8.co...
Please Test it by Downloading and Installing it from below and kindly Report any "Errors" from the Error Log.
Installation:
1. Download and install seo_friendly_urls_panel and Infuse it.
2. Add the Panel seo_friendly_urls_panel to Panels and Display it on all pages if you are adding it as Upper/Lower Panel.
3. A Small Change in maincore.php :
Find :
Codedefine("TRUE_PHP_SELF", $current_page);
Replace with :
Use this Code if you have Choose SEO URLs Type as Plain : http://yoursite.c...
Codeif (preg_match("/\/(administration)\//", $current_page))
{
define("TRUE_PHP_SELF", $current_page);
}
else if (preg_match("/".preg_replace("/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $settings['opening_page'])."/", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $current_page)))
{
define("TRUE_PHP_SELF", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "/$1", $current_page));
}
else
{
define("TRUE_PHP_SELF", $current_page);
}
Use this Code if you have Choose SEO URLs Type as HTML : http://yoursite.c...
Codeif (preg_match("/\/(administration)\//", $current_page))
{
define("TRUE_PHP_SELF", $current_page);
}
else if (preg_match("/".preg_replace("/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $settings['opening_page'])."/", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $current_page)))
{
define("TRUE_PHP_SELF", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "/$1.html", $current_page));
}
else
{
define("TRUE_PHP_SELF", $current_page);
}
Done !!!
EDIT : Sorry I forgot to include the code from HTACCESS
Also, You must paste the code in your .htaccess file.
.htaccess File attached now !
Ankur attached the following files:
Edited by Ankur on 18-07-2012 17:30
|
| |
|
|
| Halisson Ricardo |
Posted on 17-07-2012 12:24
|

Admin

Posts: 77
Joined: 31/05/2008
|
-
Seems like a great job. This feature already is natively in version 8? I'm sorry, but I'm still not fully up to date on the project v8. 
-
Halisson Ricardo
PHP-Fusion Senior Developer
NSS Brazil Admin Leader
.
.
|
| |
|
|
| Rush_ |
Posted on 17-07-2012 15:59
|

Junior Member

Posts: 22
Joined: 12/01/2011
|
that's good. but not...
for each link replaced it need to make a db query to get "news-description". do u think its normal, me not. brrrr |
| |
|
|
| Sprunkas |
Posted on 17-07-2012 16:13
|

Junior Member

Posts: 24
Joined: 14/04/2011
|
Codedefine("[b]TURE[/b]_PHP_SELF", $current_page);
i think it's mistake, here need to be TRUE i think.
Edited by Sprunkas on 17-07-2012 16:29
|
| |
|
|
| jikaka |
Posted on 17-07-2012 19:16
|

Admin

Posts: 766
Joined: 28/01/2010
|
@Ankur, my anti-virus swears at this link
|
| |
|
|
| Ankur |
Posted on 18-07-2012 08:07
|

Admin

Posts: 1292
Joined: 02/11/2010
|
halisson wrote:
-
Seems like a great job. This feature already is natively in version 8? I'm sorry, but I'm still not fully up to date on the project v8.
-
Thats a custom Mod for 7.02+, no where related to v8 
Rush_ wrote:
that's good. but not...
for each link replaced it need to make a db query to get "news-description". do u think its normal, me not. brrrr
This doesn't work in that way which will make bunch of DB Queries to database. Here is how it works :
1. Find How many News links are there on the page.
Ex: http://mysite.com/news.php?readmore=1
http://mysite.com/news.php?readmore=2
http://mysite.com/news.php?readmore=3
And it will combine it to a single/1 query :
dbquery("SELECT news_subject FROM ".DB_NEWS." WHERE news_id IN(1,2,3) " )
And this is all done before the page loads. Hence, time efficient and memory efficient 
Oops ! Sorry ! You're right ! Actually, I was testing this on an old version, in which it is TURE_PHP_SELF by mistake...
Thats surely not due to this, but due to co.cc link
|
| |
|
|
| jikaka |
Posted on 18-07-2012 08:21
|

Admin

Posts: 766
Joined: 28/01/2010
|
great work!
|
| |
|
|
| Ankur |
Posted on 18-07-2012 08:32
|

Admin

Posts: 1292
Joined: 02/11/2010
|
Hoping for more feedback and errors... or I may proceed to submit it to Addons...
Thanks...
|
| |
|
|
| Yodix |
Posted on 18-07-2012 08:53
|

Member

Posts: 72
Joined: 22/10/2010
|
A great solution. You would not have anything against it, to use it in modification for PHP-Fusion v8?
Happy Hunger Games! And may the odds be ever in your favor.
|
| |
|
|
| Sprunkas |
Posted on 18-07-2012 09:19
|

Junior Member

Posts: 24
Joined: 14/04/2011
|
I tested at my site this addon. I saw that when replacing maincore.php:
Codedefine("TRUE_PHP_SELF", $current_page);
with:
Codeif (preg_match("/\/(administration)\//", $current_page))
{
define("TRUE_PHP_SELF", $current_page);
}
else if (preg_match("/".preg_replace("/(.*)(\.php|\.html)?/", "$1", $settings['opening_page'])."/", preg_replace("/(.*)(\.php|\.html)?/", "$1", $current_page)))
{
define("TRUE_PHP_SELF", preg_replace("/(.*)(\.php|\.html)/", "$1", $current_page));
}
else
{
define("TRUE_PHP_SELF", $current_page);
}
Then don't displays forum threads at the main page. |
| |
|
|
| Ankur |
Posted on 18-07-2012 10:09
|

Admin

Posts: 1292
Joined: 02/11/2010
|
Sprunkas wrote:
I tested at my site this addon. I saw that when replacing maincore.php:
Then don't displays forum threads at the main page.
Really ? You forgot to change Site Opening Page link in Main Settings, I guess.
However, What is your website link? It would be more useful 
Yodix wrote:
A great solution. You would not have anything against it, to use it in modification for PHP-Fusion v8? 
Pardon me... but I didn't got your point... hmm?
Sorry for my bad english...
|
| |
|
|
| jikaka |
Posted on 18-07-2012 10:11
|

Admin

Posts: 766
Joined: 28/01/2010
|
instead of this:
http://fusion8.co.cc/Article-Category-2-PHP-Fusion-v7-Tutorials
better way:
http://fusion8.co.cc/article-category-2-php-fusion-v7-tutorials
best of all urls in lower case
|
| |
|
|
| Ankur |
Posted on 18-07-2012 10:14
|

Admin

Posts: 1292
Joined: 02/11/2010
|
jikaka wrote:
instead of this:
http://fusion8.co.cc/Article-Category-2-PHP-Fusion-v7-Tutorials
better way:
http://fusion8.co.cc/article-category-2-php-fusion-v7-tutorials
best of all urls in lower case
That can be simply achieved by changing text in seo_friendly_urls_panel/includes/seo_functions.php
|
| |
|
|
| Sprunkas |
Posted on 18-07-2012 10:42
|

Junior Member

Posts: 24
Joined: 14/04/2011
|
After editing maincore.php:

Before editing maincore.php:

P.S Forum threads only displays when you tick box in the panel to display at all pages.
P.S.S Not only last forum threads not displaying at main page.
Edited by Sprunkas on 18-07-2012 10:47
|
| |
|
|
| Yodix |
Posted on 18-07-2012 10:43
|

Member

Posts: 72
Joined: 22/10/2010
|
Ankur wrote:
Sprunkas wrote:
I tested at my site this addon. I saw that when replacing maincore.php:
Then don't displays forum threads at the main page.
Really ? You forgot to change Site Opening Page link in Main Settings, I guess.
However, What is your website link? It would be more useful
Yodix wrote:
A great solution. You would not have anything against it, to use it in modification for PHP-Fusion v8? 
Pardon me... but I didn't got your point... hmm?
Sorry for my bad english... 
Can I use this plugin as a modification to the PHP-Fusion v8? Suffice it to just slightly modify it
Happy Hunger Games! And may the odds be ever in your favor.
|
| |
|
|
| spunk |
Posted on 18-07-2012 15:34
|

Member

Posts: 65
Joined: 01/11/2010
|
Nice! Very very good work! 
And yes... the forum_thread_lists_panel is not working.
But otherwise on my Testsite SEO works well, i donīt see any problems... |
| |
|
|
| Ankur |
Posted on 18-07-2012 16:19
|

Admin

Posts: 1292
Joined: 02/11/2010
|
Sprunkas wrote:
P.S Forum threads only displays when you tick box in the panel to display at all pages.
P.S.S Not only last forum threads not displaying at main page.
spunk wrote:
And yes... the forum_thread_lists_panel is not working.
Weird 
This is working OK for me.
Please ensure that you have set correct Site Opening Page in Settings --> Main --> Site Opening Page
In SEO Admin Settings, if you have choosen the URL Template as Plain (http://yoursite.com/news), then site opening page should be news
Otherwise, if you have choose the template as HTML (http://yoursite.com/news.html), then site opening page should be news.html
|
| |
|
|
| spunk |
Posted on 18-07-2012 16:38
|

Member

Posts: 65
Joined: 01/11/2010
|
Hmmm Opening Page is: news.html
There is no forum_thread_list_panel 
http://dev.spicke... |
| |
|
|
| Ankur |
Posted on 18-07-2012 17:20
|

Admin

Posts: 1292
Joined: 02/11/2010
|
Try this Code in replacement in maincore.php : It works for me !
Codeif (preg_match("/\/(administration)\//", $current_page))
{
define("TRUE_PHP_SELF", $current_page);
}
else if (preg_match("/".preg_replace("/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $settings['opening_page'])."/", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "$1", $current_page)))
{
define("TRUE_PHP_SELF", preg_replace("/\/([a-zA-Z0-9_]+)(\.php|\.html)?/", "/$1.html", $current_page));
}
else
{
define("TRUE_PHP_SELF", $current_page);
}
|
| |
|
|
| spunk |
Posted on 18-07-2012 17:26
|

Member

Posts: 65
Joined: 01/11/2010
|
Ahhh THIS works!
Thank you Ankur! 
The Code in Post #1 is different... |
| |
|