When I create a link in a menu containing localhost
it doesn't naturally work from outside. When I create a link with my public IP address it doesn't work from inside. Can I use some Drupal variables for this purpose containing the site name?
2 Answers
If you are just trying to create links to pages within your Drupal site you can use relative paths and when Drupal renders the link it will show as a complete URL. You only need to have the domain name in the path when you are linking to an external site (not the same domain)
Example, to link to the Site Configuration admin page:
Use admin/settings
instead of http://localhost/admin/settings
and it will still show up in your menu as a full URL.
Enable clean URLs in apache configuration first (mod_rewrite) , then you will able to omit /q?= and hence can use admin/setting like URLS without the need of specifying domain name