views:

208

answers:

2

I developed a Drupal site on XAMPP. I deployed it to an Apache webserver by uploading a zip file and .sql file of the database. However, the links on pages generated by Views 2 are still as they were on XAMPP - http://localhost, etc. (So instead of www.example.com, it's http://localhost). Where do I change this setting?

I looked in settings.php but that doesn't appear to be it. I changed the $base_url value, but that didn't do it.

EDIT: this only applies to links generated by Views 2.

EDIT 2: Upon further investigation: it's only one specific View having this issue.

EDIT 3: When looking at the View preview on the administration page, it doesn't have this problem. The problem only occurs on the live version.

A: 

usually, you don't need to change anything when changing server - Drupal figures out it's install location and url by itself (by looking at server variables like $_SERVER['HTTP_HOST'] - see http://cvs.drupal.org/viewvc.py/drupal/drupal/includes/bootstrap.inc?annotate=1.206.2.12&pathrev=DRUPAL-6#l293). eg. when you install at http://www.example.com and request that page, it should set $base_url to http://www.example.com and rewrite the links accordingly. if it doesn't, check that

  • you don't set $base_url to another value (like localhost). note that Drupal searches for settings.php not only in sites/default, but also in other locations
  • you use Drupal's link generation functions (url, l) instead of putting hardcoded values (like localhost/...) in your themes or modules.
ax
turns out it's only links generated by Views... but I still don't know how to change it
Rosarch
+2  A: 

Given your recent edits (especially that the preview works correctly), this sounds like one of your views is still using cached data created before you deployed the site to your live environment.

Try clearing all Drupal caches, but especially the views cache at admin/build/views/tools.

Henrik Opel
I go back to it now, and the problem is already fixed. I suspect that is a result of my cache already being cleared. Thanks so much. You've answered so many of my questions haha.
Rosarch