Page 1 of 1

[Solved] New URLs and absolute/relative links

PostPosted: Wed Aug 15, 2012 5:41 pm
by RGB
There is an unexpected draw back with the new URLs: if you log on the new URL and click on a link to another post that was written using the old address you'll go to that old address... and will be logged out.

While this redirection problem is solved (I reported it on the dev mailing lists yesterday) there is one thing we can do to alleviate it: use relative URLs to cross reference posts.

The problem is that phpBB do not offer relative links by default, but this feature is easy to implement as a custom tag. I followed this post and added the relative URL tags on the ES forums: they work perfectly.

Of course this will not solve the problem of existing links, this can only be solved by a proper redirect, but I think it is a good idea to always use relative links on the forum from now on. What do you think?

Regards

Re: New URLs and absolute/relative links

PostPosted: Wed Aug 15, 2012 6:30 pm
by Hagar Delest
Sounds good, it would spare some work in the future I guess.

I've added the tag (appear on the right of the BBCodes top of the message area.
Is it the correct string?
Code: Select all   Expand viewCollapse view
[rel=viewtopic.php?f=102&t=55691]link to the post above[/rel]

link to the post above seems to work fine.

Re: New URLs and absolute/relative links

PostPosted: Wed Aug 15, 2012 7:04 pm
by RGB
Hagar Delest wrote:Is it the correct string?


At least it is the same string I used on the ES forum ;)

Re: [Solved] New URLs and absolute/relative links

PostPosted: Tue Aug 21, 2012 1:54 pm
by TerryE
RGB wrote:Of course this will not solve the problem of existing links

This substitution is pretty straight forward for someone who has command line access to the MySQL database. Perhaps Imacat can do this for you.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Tue Aug 21, 2012 11:09 pm
by RGB
Hy, Terry! Nice to read you again.

I think there are two situations, one straightforward, the other not so.

The straightforward situation is a properly formatted url tag used to cross reference another thread: in this situation, changing url=http://....../viewtopic..... with rel=viewtopic...... and the corresponding /url with a /rel is enough. But the problem is that most people do not format the urls, they just copy paste them. To change a simple

Code: Select all   Expand viewCollapse view
http://forum.openoffice.org/en/forum/viewforum.php?f=76

to a relative address several changes needs to be done. Maybe if a "lone url" is found, then use the "viewtopic...." as link text:

Code: Select all   Expand viewCollapse view
[rel=viewforum.php?f=76]viewforum.php?f=76[/url]

Some regexp magic is needed.

Also, AFAIK the rel tag is only used here and on the ES forum.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Thu Aug 23, 2012 5:22 pm
by TerryE
Yup, but unfortunately the regexp support in MySQL is limited to matching only rather than substitution, so you can't do this with a simple MySQL statement. You need to write a small batch script which does a select, mangle, update on the post table for all posts containing 'http://forum.openoffice.org/../forum/'. One for Imacat, sorry.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Fri Aug 24, 2012 2:06 am
by kingfisher
I don't know why this has been marked as solved. I have reverted to the old url because the new one requires me to log in every time I use it.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Fri Aug 24, 2012 8:05 am
by floris v
Same for me.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Fri Aug 24, 2012 9:34 pm
by RGB
kingfisher wrote:I don't know why this has been marked as solved. I have reverted to the old url because the new one requires me to log in every time I use it.

The thread was about introducing the "relative link tag", which is now working.

Re: [Solved] New URLs and absolute/relative links

PostPosted: Sat Aug 25, 2012 4:03 am
by kingfisher
OK. Thanks. I'll continue using the old urls. It's a real pest when I get an email containing a link using the new path.