# On Relative Links and a Simplified URL structure

+ 0 like - 0 dislike
124 views

I realised a few days back, that while using the most simplified URL structure, /123/why-do-birds-sing, relative links don't work! The simplest URL structure for which it works is /?qa=123/why-do-birds-sing, Here is the exact description of the problem that I sent to polarkernel just today.

Or if I click on a link to say, /4606/can-we-install-comment-rating, then I am instead directed to /4636/4606/can-we-install-comment-rating. [...]

One solution is that just before we go online, public, we make all the relative links absolute.

However, this would be very time consuming. Is there a way to probably edit the htaccess file itself, so that the relative links are still correct?

I have turned the simplest URL structure on for a while just so that you understand what I mean. Here are a few links:

4606

./4606

/4606

retagged Mar 16, 2014

+ 2 like - 0 dislike

This is a cautionary tale on the fact, that on a system which is that complex, changes should only be made if well understood and tested.

If we look at the source code of a page using this /123/why-do-birds-sing URL structure, we see that all relative links created by Q2A are now written as ../link, using a double-dot slash.

In order to rescue this situation, I have made a patch (fortunately possible within my OverSnow theme) that corrects all relative links in questions, answers and comments, so that the following types of links work correctly:

This should repair almost everything. Links made by hand by us administrators, like those in the upper side-panel, have to be absolute. We will have to think on that if we move to go online.

answered Mar 16, 2014 by (0 points)

Thanks! That greatly simplifies the work needed to do, and definitely saves the situation : )

 Please use answers only to (at least partly) answer questions. To comment, discuss, or ask for clarification, leave a comment instead. To mask links under text, please type your text, highlight it, and click the "link" button. You can then enter your link URL. Please consult the FAQ for as to how to format your post. This is the answer box; if you want to write a comment instead, please use the 'add comment' button. Live preview (may slow down editor)   Preview Your name to display (optional): Email me at this address if my answer is selected or commented on: Privacy: Your email address will only be used for sending these notifications. Anti-spam verification: If you are a human please identify the position of the character covered by the symbol $\varnothing$ in the following word:p$\hbar$ysicsOverflo$\varnothing$Then drag the red bullet below over the corresponding character of our banner. When you drop it there, the bullet changes to green (on slow internet connections after a few seconds). To avoid this verification in future, please log in or register.