Question

I have a dedicated server with many different sub-folders/accounts. I have a test-installation for a new Joomla 2.5 site on one of these accounts/sub-folders that doesn't have a domain name associated with it yet. I have to access it by

http://(SERVER-IP)/~subfolder/

rather than

http://www.example.com/

Most of my link types are working smoothly (ie, "Single Article" links to the correct article alias, etc.) however when I use an External URL menu item type to link to an internal article alias, things go bad... Within the Menu Item options I put "/contact-us" in the Link field so that (in theory) I can link to

http://(SERVER-IP)/~subfolder/index.php/contact-us

however it is removing the subfolder, causing it to link to the apache root of the dedicated server instead, resulting in:

http://(SERVER-IP)/contact-us

I only have this issue when I use IP addresses instead of a domain name...

I have URL re-writing OFF, so it is not the .htaccess file causing the problems...is there an issue with the defined Absolute Path? Any ideas on how I can get this fixed so I can stop seeing 404-errors while in development? Thanks for any and all help pointing me in the right direction!

Was it helpful?

Solution

The beginning forward slash means start at document root, so it basically says to strip all "folders" down to the root domain (which on your dev system means just the IP address).

One option is to use the base tag to set up relative links for the external url menu type. You could add this to your template file's index.php just after the <head> declaration:

<base href="<?php echo JURI::root(); ?>" />

This can introduce a host of issues with relative links though, so you may want to weigh the issues with that here: Is it recommended to use the <base> html tag?

The second option would be to try it with index.php at the start, so make the url index.php/contact-us. I believe that this will be routed properly as an internal link.

This will cause an issue if you go live and turn on htaccess URL rewriting. I just checked and this will not have the index.php section removed, so that is an issue.

The third option (which takes more work but is probably recommended) is to stop linking to internal urls with external url menu items. Joomla tends to function best when you set up a menu item for your urls. (Much of the url routing is based around the menu item.)

Really the third option is that it may be easier to help you not use the External URL menu item than to fix the routing issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top