1

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 2

5

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.

2
  • I can't do this. I have in the path localhost/?q=something if I replace it with ?q=something it doesn't work.
    – xralf
    Commented Jun 22, 2011 at 20:16
  • Don't type in ?q=something for the path, instead simply use something and Drupal will add the ?q= later
    – Laxman13
    Commented Jun 22, 2011 at 20:21
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.