joomla/joomla-cms — pull request #4309 by jo-sf (2014-09-19 17:53:58+00:00)
Title: Allow relative URLs for links A/B/C in articles

Suppose you have a Joomla website that is reachable via different domain names or via HTTP and HTTPS. If you want to use the links A/B/C in your articles (I assume that your template knows what to do with these, which is the case e.g. with the Beez 5 template) you currently have to decide which of your domain names you want to use resp. whether you want to use HTTP or HTTPS as protocol if you want to assign links to other pages within your website to the links A/B/C.

This PR proposes changes which allow to assign internal links to the links A/B/C.

About testing these changes:
- it is possible to assign to the links A/B/C both in the backend and in the frontend, but for the frontend it must be enabled first in the options menu of the article manager
- there are four cases to be considered in testing:
- Joomla is installed in the document root of your webserver
- SEO URL rewriting is not active (means: all server relative paths start with "index.php")
- SEO URL rewriting is active
- Joomla is installed in a subdirectory of the document root of your webserver
- SEO URL rewriting is not active (means: all server relative paths start with the subdirectory followed by "index.php")
- SEO URL rewriting is active

For testing I used the fruit shop welcome page from the example installation but any other pages should work as well. I added links to the "Apples", "Bananas" and "Tamarind" pages to the "Welcome" page of the fruit shop.

What should work with these changes (and what not) - examples based upon the fruit shop pages:
- document root installation, no URL rewriting
- index.php/fruit-encyclopedia/38-a => /index.php/fruit-encyclopedia/38-a
- /index.php/fruit-encyclopedia/38-a => will not be changed
- http://<ServerName>/index.php/fruit-encyclopedia/38-a => will not be changed
- document root installation, URL rewriting
- fruit-encyclopedia/38-a.html => /fruit-encyclopedia/38-a.html
- /fruit-encyclopedia/38-a.html => will not be changed
- http://<ServerName>/fruit-encyclopedia/38-a.html => will not be changed
- subdirectory installation (j25/), no URL rewriting
- index.php/fruit-encyclopedia/38-a => /j25/index.php/fruit-encyclopedia/38-a
- j25/index.php/fruit-encyclopedia/38-a => /j25/j25/index.php/fruit-encyclopedia/38-a (wrong!)
- /j25/index.php/fruit-encyclopedia/38-a => will not be changed
- http://<ServerName>/j25/index.php/fruit-encyclopedia/38-a => will not be changed
- subdirectory installation (j25/), URL rewriting
- fruit-encyclopedia/38-a.html => /j25/fruit-encyclopedia/38-a.html
- j25/fruit-encyclopedia/38-a.html => /j25/j25/fruit-encyclopedia/38-a.html (wrong!)
- /j25/fruit-encyclopedia/38-a.html => will not be changed
- http://<ServerName>/j25/fruit-encyclopedia/38-a.html => will not be changed

I know that there are other components in Joomla which also allow to enter URLs,e.g. the contact manager. It is probably also in those components of interest to allow internal URLs beside the external URLs currently only allowed there. If you enter a relative URL (means: URL without protocol etc.) the library routines do their best to convert this URL into an external URL (see libraries(joomla/form/form.php for details) but by principle it cannot work well always though I found an error in this part and corrected it as part of my changes.