Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

SEO URLs for PHP-Fusion | Alpha Testing

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.cc/

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 :
CodeDownload  
define("TRUE_PHP_SELF", $current_page);


Replace with :
Use this Code if you have Choose SEO URLs Type as Plain : http://yoursite.com/news
CodeDownload  
if (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.com/news.html
CodeDownload  
if (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 file:
seo_friendly_urls_panel.zip [10.68kB / 683 Downloads]
htaccess.zip [1.62kB / 688 Downloads]
-

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. :)

-
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
CodeDownload  
define("TURE_PHP_SELF", $current_page);

i think it's mistake, here need to be TRUE i think.
@Ankur, my anti-virus swears at this link

Quote

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 :)

Quote

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 ;)

Quote

Sprunkas wrote:

i think it's mistake, here need to be TRUE i think.


Oops ! Sorry ! You're right ! Actually, I was testing this on an old version, in which it is TURE_PHP_SELF by mistake...

Quote

jikaka wrote:

@Ankur, my anti-virus swears at this link


Thats surely not due to this, but due to co.cc link B)
great work!
Hoping for more feedback and errors... or I may proceed to submit it to Addons...

Quote

jikaka wrote:

great work!


Thanks... :)
A great solution. You would not have anything against it, to use it in modification for PHP-Fusion v8? :)
I tested at my site this addon. I saw that when replacing maincore.php:

CodeDownload  
define("TRUE_PHP_SELF", $current_page);


with:

CodeDownload  
if (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.

Quote

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 B)

Quote

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... :|
instead of this:

Quote

http://fusion8.co.cc/Article-Category-2-PHP-Fusion-v7-Tutorials


better way:

Quote

http://fusion8.co.cc/article-category-2-php-fusion-v7-tutorials


best of all urls in lower case

Quote

jikaka wrote:

instead of this:

Quote

http://fusion8.co.cc/Article-Category-2-PHP-Fusion-v7-Tutorials


better way:

Quote

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 :G
After editing maincore.php:
img3.imageshack.us/img3/3953/91929617.png
Before editing maincore.php:
img29.imageshack.us/img29/2524/23545615.png

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.

Quote

Ankur wrote:

Quote

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 B)

Quote

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 :|
Nice! Very very good work! :G

And yes... the forum_thread_lists_panel is not working.

But otherwise on my Testsite SEO works well, i don´t see any problems...

Quote

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.


Quote

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 B)

Quote

spunk wrote:

Hmmm Opening Page is: news.html

There is no forum_thread_list_panel :|

http://dev.spicker.info


Try this Code in replacement in maincore.php : It works for me !

CodeDownload  
if (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);
}

Ahhh THIS works!

Thank you Ankur! :G

The Code in Post #1 is different...
Thread Information
Author
Replies
26 posts
Views
21,183 times
Last Post
Last updated on 6 years ago
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
Users who participated in discussion: Hal Ricard, jikaka, Yodix, spunk, Ankur, Rush_, Sprunkas, KasteR, Adrijan