1

I'm working locally on my Mac with the latest version of CiviCRM on latest WordPress, served by MAMP. Using the API, I create an attachment to a contact, and those attachments successfully display after being retrieved through the API. The URL comes back as http://localhost/civicrm?page=CiviCRM&q=civicrm%2Ffile&reset=1&id=15&eid=29&fcs=...

However, when I upload the code and database records to the remote server for testing, the one thing that doesn't work are my attachments. The URLs come back from the API missing a slash: http://remotedomain.comcivicrm?page=CiviCRM&q=civicrm%2Ffile&reset=1&id=15&eid=29&fcs=... Notice the missing slash after the `.com?

I've double checked the configuration in civicrm.settings.php. Both localhost and remotedomain.com have a / in the URL base. I checked the various settings in the admin interface, but nothing looks amiss.

What could be causing this issue?

  • Just a thought: Is the remote server linux or windows? – Demerit Jul 15 at 23:11
  • I'm assuming Linux since the paths begin with /home/username/ – repertor Jul 15 at 23:20
  • Ok it was just a thought. It seems to work ok on wpmaster.demo.civicrm.org, using the api explorer, so it makes me think it would be something to do with config somewhere. – Demerit Jul 15 at 23:56
  • A configuration issue seems to be the likely explanation, right!? But I export the DB from localhost to remote, swapping in the domain with find-and-replace. And I upload the config file as-is, with code that inserts http://localhost/ or http://remotedomain.com/ as applicable with the terminal slashes. So what gives...? – repertor Jul 16 at 2:49
0

Can you check

  1. Check if base url in civicrm.settings.php file is set 'http://remotedomain.com/'.
  2. Try setting home and siteurl in wp_options table to 'http://remotedomain.com/' (not needed for normal install).

Cheers

Pradeep

  • civicrm.settings.php has a value for CIVICRM_UF_BASEURL that is set for the correct remote URL, including the last / wp_options already has both values set with the correct remote domain, including the / at the end. – repertor Jul 16 at 12:12
  • How about in civicrm.settings.php? – Pradeep Nayak Jul 16 at 12:15
  • Return submitting and not doing a line return in comments always gets me – repertor Jul 16 at 12:16
  • 1
    I may have discovered a bug. I print_fd the globals $civicrm_root, $civicrm_setting, $civicrm_paths and saw on the remote server that even though [wp.frontend.base] was defined in civicrm.settings.php with the slash (I could see it right there in the variable definition), it was being dropped. So I added another slash. Then there were two! So I removed one, and now it's working...! – repertor Jul 16 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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