2.8.0 - tracking pixel link in emails

In my instance of Mautic, installed on a subirectory

Code:
/m
of my main domain, the traking link automatically inserted on the out-going emails has the wrong path.
Code:
3D""


My Mautic installation is:
Code:
http://www.eserciziodiavvocatura.it/m

The (wrong) generated email traking link as per the email body code above is:
Code:
http://www.eserciziodiavvocatura.it/email/59034a681c181.gif

The correct path should be:
Code:
http://www.eserciziodiavvocatura.it/m/email/59034a681c181.gif

The contents of the .htaccess file found on the root of the Mautic instance is the following:
Code:
# Use the front controller as index file. It serves as a fallback solution when # every other rewrite/redirect fails (e.g. in an aliased environment without # mod_rewrite). Additionally, this reduces the matching process for the # start page (path "/") because otherwise Apache will apply the rewriting rules # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). #DirectoryIndex index.php RewriteEngine On
# Set Authorization header for OAuth1a for when php is running under fcgi
RewriteCond %{HTTP:Authorization} .+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Determine the RewriteBase automatically and set it as environment variable.
# If you are using Apache aliases to do mass virtual hosting or installed the
# project in a subdirectory, the base path will be prepended to allow proper
# resolution of the app.php file and to redirect to the correct URI. It will
# work in environments without path prefix as well, providing a safe, one-size
# fits all solution. But as you do not need it in this case, you can comment
# the following 2 lines to eliminate the overhead.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::2$
RewriteRule ^(.*) - [E=BASE:%1]

# Redirect to URI without front controller to prevent duplicate content
# (with and without `/app.php`). Only do this redirect on the initial
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
# endless redirect loop (request -> rewrite to front controller ->
# redirect -> request -> ...).
# So in case you get a "too many redirects" error or you always get redirected
# to the start page because your Apache does not expose the REDIRECT_STATUS
# environment variable, you have 2 choices:
# - disable this feature by commenting the following 2 lines or
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
#   following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

# Rewrite all other queries to the front controller.
RewriteRule .? %{ENV:BASE}/index.php [L]

<IfModule !mod_rewrite.c>

# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 302 ^(?!/(index.php|index_dev.php|app|addons|plugins|media|upgrade))(/(.*))$ /index.php$2
# RedirectTemp cannot be used instead

# @link https://github.com/mautic/mautic/issues/1504 php_value always_populate_raw_post_data -1

Any help / suggestion would be really appreciated.

Thank you

In my instance of Mautic, installed on a subirectory /m of my main domain, the traking link automatically inserted on the out-going emails has the wrong path.

<img height=3D"1" width=3D"1" src=3D"http://www.eserciziodiavvocatura.it/em= ail/59034a681c181.gif" alt=3D"" /></body></html>

My Mautic installation is:

http://www.eserciziodiavvocatura.it/m

The (wrong) generated email traking link as per the email body code above is:

http://www.eserciziodiavvocatura.it/email/59034a681c181.gif

The correct path should be:

http://www.eserciziodiavvocatura.it/m/email/59034a681c181.gif

The contents of the .htaccess file found on the root of the Mautic instance is the following:


# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
#DirectoryIndex index.php

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Set Authorization header for OAuth1a for when php is running under fcgi
    RewriteCond %{HTTP:Authorization} .+
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Determine the RewriteBase automatically and set it as environment variable.
    # If you are using Apache aliases to do mass virtual hosting or installed the
    # project in a subdirectory, the base path will be prepended to allow proper
    # resolution of the app.php file and to redirect to the correct URI. It will
    # work in environments without path prefix as well, providing a safe, one-size
    # fits all solution. But as you do not need it in this case, you can comment
    # the following 2 lines to eliminate the overhead.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Redirect to URI without front controller to prevent duplicate content
    # (with and without `/app.php`). Only do this redirect on the initial
    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
    # endless redirect loop (request -> rewrite to front controller ->
    # redirect -> request -> ...).
    # So in case you get a "too many redirects" error or you always get redirected
    # to the start page because your Apache does not expose the REDIRECT_STATUS
    # environment variable, you have 2 choices:
    # - disable this feature by commenting the following 2 lines or
    # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
    #   following RewriteCond (best solution)
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^(?!/(index.php|index_dev.php|app|addons|plugins|media|upgrade))(/(.*))$ /index.php$2
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>

<IfModule mod_php5.c>
    # @link https://github.com/mautic/mautic/issues/1504
    php_value always_populate_raw_post_data -1
</IfModule>

Any help / suggestion would be really appreciated.

Thank you

@MxyzptlkFishStix thank you for trying to help this hopeless dumb me.

I have followed your suggestion both deleting the email and re-creating it, and I also (following your suggestion principle) deleted and recreated the relevant campaign. Unfortunately the outcome is still the same, the link to the tracking pixel is generated without including the Mauting installation directory /m/.

<img height=3D"1" width=3D"1" src=3D"http://www.eserciziodiavvocatura.it/em=
ail/59049b8283a0e.gif" alt=3D"" /></body></html>

Please note that the link to the email from the Mautic contact panel is correct, see the image below:

http://imgur.com/a/n8ylJ

Finally, I would also like to add the if I use the function “send email” via the relevant button into the contact’s page, the link to the tracking gif is generated correctly.

Is there anything else that in your opinion I may try to resolve the issue?

Thank you for your patience and also thank you for what you are doing for this community. If there’s anything I can do to help, just let me know.

Thank you again,
Giovanni

I have currently resolved with the below hack - I am not sure if this will actually generate different issues somewhere else:

Modification on .htaccess of the root directory (and not on the .htaccess of the mautic installation folder).

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/email(.*) /m/email$1
</IfModule>

This also seems to resolve the unsubsribe link and “Having trouble reading this email? Click here.” link which were also broken.

Hi,

I’m having the same problem. Pixel emails sent by campaigns do not work, but test emails work.

@jaison you can try the workaround which worked for me. It’s published above as the answer to this thread. Make sure you use your own paths!

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/email(.*) /YOURMAUTICINSTALLATIONPATHHERE/email$1
</IfModule>

Ciao

Hello jCst,

At the moment I am using this way to solve, but I do not consider the ideal.

I had to create one more rule to make the links email works. Now I do not know if any more specific cases are missing. Therefore, the ideal would be to better understand the problem. Here are the rules:

RedirectMatch 302 ^/email(.) /mmautic/email$1
RedirectMatch 302 ^/r/(.
) /mmautic/r/$1

@jaison I had to do the same ( see this thread https://www.mautic.org/community/index.php/7359-mautic-2-7-1-campaign-email-links-not-working-is-it-a-known-bug ).


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
##Below, redirect for broken email link to the tracking gif
RedirectMatch 301 ^/email(.*) /YOURMAUTICINSTALLATIONPATHHERE/email$1
##Below, redirect for broken email links
RedirectMatch 301 ^/r(.*) /YOURMAUTICINSTALLATIONPATHHERE/r$1
</IfModule>

By the way @jaison in my situation I did not add the slash between the /r and the $1 instaead you did put a / . I am no expert, but did you check that your email links are working?

I agree it’s not ideal, I believe it may be a bug, but at least this allows to keep balls rolling.

Ciao

@jCst,

Email links are working normally. I just do not know if there are any other links I do not know that may be broken.

Maybe it’s dangerous a ^/r(.*), because if you have a folder on your server of type /repport it could not redirect too? Take a test to be sure.

Thanks for the help. If you find the solution, please share.

@jaison no solution yet - sorry.

Adding the / after the r is better - my solution generated a 404 on a page whose name was commencing with r.

Thanks