CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Tracking links in CiviMail do not redirect to target link
Pages: [1]

Author Topic: Tracking links in CiviMail do not redirect to target link  (Read 793 times)

RicardoDavis

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4 (yay!)
  • CMS version: 7
  • MySQL version: 5.1
  • PHP version: 5.2
Tracking links in CiviMail do not redirect to target link
November 04, 2011, 02:24:08 pm
For some strange reason the tracking links in CiviMail don't redirect to the target URL when clicked.  However the report does indicate that the tracking links were clicked, who clicked them, and lists the target URL.

I did check to make sure that the directories in the path to url.php and the file itself had read + execute permissions enabled.

Any ideas on what to check?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Tracking links in CiviMail do not redirect to target link
November 04, 2011, 04:36:47 pm

what happens when u click on them?

might be easiest to just debug url.php and trace thru the code and figure out whats happening and why

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

RicardoDavis

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4 (yay!)
  • CMS version: 7
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Tracking links in CiviMail do not redirect to target link
November 07, 2011, 08:43:37 am
Lobo, when anyone clicks on the tracking link then they are taken to url.php but nothing happens after that.  Here the output of running a tracking URL through wget:

Quote
--2011-11-07 09:03:07--  http://www.personhood.us/sites/all/modules/civicrm/extern/url.php?u=79
Resolving www.personhood.us... 67.222.54.95
Connecting to www.personhood.us|67.222.54.95|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `url.php?u=79'

     0K                                                        21.0K=0s

Last-modified header missing -- time-stamps turned off.
2011-11-07 09:03:08 (21.0 KB/s) - `url.php?u=79' saved [1]

Noticed that there was no HTML data in the response (zero K); yet the tracking report reflects the visit.  So I figure that things go awry just after that point.  Before I had to dive into debugging url.php I wanted to make sure there was no other known issue that could have caused this problem.  Any pointers on where to start looking in the PHP code would be appreciated.

RicardoDavis

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4 (yay!)
  • CMS version: 7
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Tracking links in CiviMail do not redirect to target link
November 14, 2011, 12:30:11 pm
The problem here was my settings_location.php. In troubleshooting another problem I found a discussion about my issue and the fix was to use the settings_location.php file to set CIVICRM_CONFDIR.  I just copied the code snippet out of the "solution" provided not thinking about the possible side affects with other PHP code including this file. 

The problem with my settings_location.php file is that it had a closing php tag (?>) followed by two line breaks. Tracing the problem:

url.php > includes
   civicrm.config.php > includes
      settings_location.php

then returns to url.php where the url redirection is set using php header(‘Location: URL’).  But header() is called; when using header() it MUST be the first thing printed to page. If anything is echoed to the page before header() is called, it will fail... and it did.  The problem is that by adding a closing php tag to settings_location.php -- and then following it with two line breaks -- a line break was printed to the page before the header() directive -- causing it to not redirect properly.  Removing the two empty lines and the closing "?>" resolved the problem.

(HT to Brian S. for his assistance in finding the root cause of this problem!  I haven't done regular PHP coding since the early v. 4 days, but I'm getting back into it after a long visit to ASP/ASP.NET land.)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Tracking links in CiviMail do not redirect to target link

This forum was archived on 2017-11-26.