2013-06-07, 01:39 AM
Hi,
I have written a plugin and used my own SEF scheme for this. The SEO scheme is directory based i.e.
http://url/plugin-name/querystring1/quer...ring3.html
This is the most keyword rich way of doing things and easier to read for users.
This all works fine, however mybb has relative paths set for a few things such as the PM notification and the Open Buddy list
I am sure there will be others though I haven't looked yet.
What I want to know is, if there is a way to globally fix these relative paths without having to individually change them or set a <base> tag in the <head>
I don't want to have to ask all users of the plugin to make that change, rather I would prefer the plugin fix this or globally fix the relative paths to absolutes for them.
Dan
feel free to move this to plugin >> Development if you wish
Ok I fixed this. I created a function
This just quickly checks any link on the page, before the page is output and changes links to absolute.
Not a world beater but seems to work well
I have written a plugin and used my own SEF scheme for this. The SEO scheme is directory based i.e.
http://url/plugin-name/querystring1/quer...ring3.html
This is the most keyword rich way of doing things and easier to read for users.
This all works fine, however mybb has relative paths set for a few things such as the PM notification and the Open Buddy list
I am sure there will be others though I haven't looked yet.
What I want to know is, if there is a way to globally fix these relative paths without having to individually change them or set a <base> tag in the <head>
I don't want to have to ask all users of the plugin to make that change, rather I would prefer the plugin fix this or globally fix the relative paths to absolutes for them.
Dan
feel free to move this to plugin >> Development if you wish
Ok I fixed this. I created a function
function mytipper_rel_to_abs(&$page) {
global $mybb;
$page = preg_replace("#(<\s*a\s+[^>]*href\s*=\s*[\"'])(?!http)([^\"'>]+)([\"'>]+)#", '$1'.$mybb->settings["bburl"].'/$2$3', $page);
return $page;
}
This just quickly checks any link on the page, before the page is output and changes links to absolute.
Not a world beater but seems to work well