Module: Search Engine Friendly URL's
Posted by Martijn van Maasakkers
Re: Module: Search Engine Friendly URL's October 15, 2013 04:42PM |
Registered: 11 years ago Posts: 5 |
Re: Module: Search Engine Friendly URL's February 07, 2014 03:47PM |
Registered: 10 years ago Posts: 2 |
This is a great module that could really improve hits from Google, but it lacks handling of cyrillic letters. I did a sample modification that could help to properly convert cyrillic to latin in URLs. This should work for Bulgarian and Russian.
You need a new function inside:
Then you have to patch sef_urls_convert to call the above function to make sure that cyrillic characters are translated:
Hope this would be helpful.
You need a new function inside:
Language: PHPfunction cyr2lat($str) { $tr = array( "А"=>"a", "Б"=>"b", "В"=>"v", "Г"=>"g", "Д"=>"d", "Е"=>"e", "Ё"=>"yo", "Ж"=>"zh", "З"=>"z", "И"=>"i", "Й"=>"j", "К"=>"k", "Л"=>"l", "М"=>"m", "Н"=>"n", "О"=>"o", "П"=>"p", "Р"=>"r", "С"=>"s", "Т"=>"t", "У"=>"u", "Ф"=>"f", "Х"=>"h", "Ц"=>"tz", "Ч"=>"ch", "Ш"=>"sh", "Щ"=>"sht", "Ъ"=>"y", "Ы"=>"y", "Ь"=>"y", "Э"=>"e", "Ю"=>"u", "Я"=>"ya", "а"=>"a", "б"=>"b", "в"=>"v", "г"=>"g", "д"=>"d", "е"=>"e", "ё"=>"yo", "ж"=>"zh", "з"=>"z", "и"=>"i", "й"=>"j", "к"=>"k", "л"=>"l", "м"=>"m", "н"=>"n", "о"=>"o", "п"=>"p", "р"=>"r", "с"=>"s", "т"=>"t", "у"=>"u", "ф"=>"f", "х"=>"h", "ц"=>"tz", "ч"=>"ch", "ш"=>"sh", "щ"=>"sht", "ъ"=>"y", "ы"=>"y", "ь"=>"", "э"=>"e", "ю"=>"yu", "я"=>"ya"); return strtr($str,$tr); }
Then you have to patch sef_urls_convert to call the above function to make sure that cyrillic characters are translated:
Language: PHPfunction sef_urls_convert($strValue) { // Patch to handle cyrillics $strValue = cyr2lat($strValue); // End of patch $strValue = preg_replace("/([^a-zA-Z0-9\-_\ ])/", "_", $strValue); $strValue = preg_replace("/([\ ])/", "_", $strValue); $strValue = strtolower($strValue); return $strValue; }
Hope this would be helpful.
Re: Module: Search Engine Friendly URL's March 06, 2014 04:54AM |
Registered: 10 years ago Posts: 2 |
Hi there
We found some strange bug: the SEO URLs Modul destroyed the Phorum Search Result links. At the search page is not a global phorum id set ($PHORUM['forum_id'] and its needed to set the forum_id manually on the link generator, here is a Fix for the Problem:
Edited 1 time(s). Last edit at 03/06/2014 04:59AM by KatyWings.
We found some strange bug: the SEO URLs Modul destroyed the Phorum Search Result links. At the search page is not a global phorum id set ($PHORUM['forum_id'] and its needed to set the forum_id manually on the link generator, here is a Fix for the Problem:
Sincere regards, KatyLanguage: PHPfunction sef_urls_search($arrList) { // XXX> lka: Forum ID wird nicht in den URLS mitgegeben, gefixt foreach($arrList as $intID => $arrMessage) { $read_url_template_thread = phorum_get_url(PHORUM_FOREIGN_READ_URL,$arrMessage[';forum_id';],';%thread_id%';); $read_url_template_both = phorum_get_url(PHORUM_FOREIGN_READ_URL,$arrMessage[';forum_id';],';%thread_id%';,';%message_id%';); // <XXX $strSubject = sef_urls_convert($arrMessage[';subject';]); $arrList[$intID]["URL"]["READ"] = sef_urls_create_read_link($arrMessage, $read_url_template_thread, $read_url_template_both); } return $arrList; }
Edited 1 time(s). Last edit at 03/06/2014 04:59AM by KatyWings.
Re: Module: Search Engine Friendly URL's June 04, 2014 04:13AM |
Registered: 10 years ago Posts: 6 |
Hello Martijn
Thank you for the wonderful module! :)
I had a problem with the module at first because of the following setting of my .htaccess file:
It cased all requests to be redirected to /index/
But when I changed it to
and it fixed the problem.
I thought maybe my experience would be helpful for someone having problems with the module.
Thank again for the very useful module!
Thank you for the wonderful module! :)
I had a problem with the module at first because of the following setting of my .htaccess file:
Options +MultiViews
It cased all requests to be redirected to /index/
But when I changed it to
Options -MultiViews
and it fixed the problem.
I thought maybe my experience would be helpful for someone having problems with the module.
Thank again for the very useful module!
Re: Module: Search Engine Friendly URL's June 04, 2014 01:25PM |
Registered: 10 years ago Posts: 6 |
The other thing to think about is when you edit the subject it also causes the URL change.
And you result with two different URLs leading to the same page.
Would have been nice to have a redirect to the current version of the page (moved permanently).
Otherwise google won't be happy with multiple URLs leading to a page with the same content.
ADDED:
Maybe something like this?
Edited 2 time(s). Last edit at 06/04/2014 03:16PM by deepvision.
And you result with two different URLs leading to the same page.
Would have been nice to have a redirect to the current version of the page (moved permanently).
Otherwise google won't be happy with multiple URLs leading to a page with the same content.
ADDED:
Maybe something like this?
Language: PHPfunction sef_urls_read($arrList, $message_id = 0) { global $PHORUM; $read_url_template_thread = phorum_get_url(PHORUM_READ_URL, ';%thread_id%';); $read_url_template_both = phorum_get_url(PHORUM_READ_URL, ';%thread_id%';,';%message_id%';); $read_page_url_template = phorum_get_url(PHORUM_READ_URL, ';%thread_id%';,';page=%page_num%';, ';_subject_';); if($message_id && isset($arrList[$message_id])){ $url = sef_urls_create_read_link($arrList[$message_id], $read_url_template_thread, $read_url_template_both); if(!isset($_SERVER["REQUEST_SCHEME"])) $_SERVER["REQUEST_SCHEME"] = "http"; if($url != $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]){ header("HTTP/1.1 301 Moved Permanently"); header("Location:".$url); exit(0); } } $edit_url_template = phorum_get_url(PHORUM_POSTING_URL, ';%action_id%';, ';%message_id%';); $reply_url_template = phorum_get_url(PHORUM_REPLY_URL, ';%thread_id%';, ';%message_id%';); $reply_url_template_quote = phorum_get_url(PHORUM_REPLY_URL, ';%thread_id%';, ';%message_id%';,';quote=1';); $profile_url_template = phorum_get_url(PHORUM_PROFILE_URL, ';%forum_id%';, ';%user_id%';, ';_username_';); ....
Edited 2 time(s). Last edit at 06/04/2014 03:16PM by deepvision.
Re: Module: Search Engine Friendly URL's May 17, 2015 02:01PM |
Registered: 9 years ago Posts: 1 |
I have a question How to get the RSS links to be the same as the SEF links ?
Maybe this could be a simple htaccess fix also EXAMPLE:
I need this link in rss [www.shtf.support]
made to this link that is the forum link : [www.shtf.support]
Maybe this could be a simple htaccess fix also EXAMPLE:
I need this link in rss [www.shtf.support]
made to this link that is the forum link : [www.shtf.support]
Sorry, only registered users may post in this forum.