# On Relative Links and a Simplified URL structure

+ 0 like - 0 dislike
156 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$ysi$\varnothing$sOverflowThen 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.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.38954073190689087, "perplexity": 1514.2056822349577}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-10/segments/1614178365454.63/warc/CC-MAIN-20210303042832-20210303072832-00043.warc.gz"}