Skip to main content

Apache configuration

To achieve the best performance, you need the following Apache modules enabled:

  • mod_rewrite
  • mod_proxy
  • mod_proxy_https

With mod_proxy

You need to update your .htaccess file with the following lines. You need to locate them before other rewrite rules.

.htaccess
# BEGIN: Contimo integraton
RewriteEngine On
RewriteRule ^VIRTUAL_FOLDER/(.*)$ https://advertorials.contimo.app/websites/WEBSITE_ID/$1?contimoToken=CONTIMO_TOKEN [P,L]
# END: Contimo integration

Example:

.htaccess
# BEGIN: Contimo integraton
RewriteEngine On
RewriteRule ^advertorials/(.*)$ https://advertorials.contimo.app/websites/63ac46935c83c5212576f699/$1?contimoToken=z61ma1721n [P,L]
# END: Contimo integration

Without mod_proxy

If you don't have mod_proxy enabled, you can use PHP script to act as a proxy. If you don't have PHP on your webserver, you need to write a proxy script in the scripting language enabled on your webserver (like Python).

Step 1 - create contimo.php

contimo.php
<?php

$websiteId = $_GET['websiteId'];
$contimoToken = $_GET['contimoToken'];
$uri = $_GET['uri'];

$url = "https://advertorials.contimo.app/websites/$websiteId/test-contimo-integration/$uri?contimoToken=$contimoToken";

// Initialize cURL
$curl = curl_init();

// Set the cURL options
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

// Execute the cURL request
$response = curl_exec($curl);

// Get the response headers
$responseHeaders = curl_getinfo($curl);

// Send the response headers
foreach ($responseHeaders as $header => $value) {
header("$header: $value");
}

// Send the response
echo $response;

// Close the cURL session
curl_close($curl);

Step 2 - update .htaccess

You need to update your .htaccess file with the following lines. You need to locate them before other rewrite rules.

.htaccess
# BEGIN: Contimo integraton
RewriteEngine On
RewriteRule ^VIRTUAL_FOLDER/(.*)$ contimo.php?websiteId=WEBSITE_ID&contimoToken=CONTIMO_TOKEN&uri=$1 [L]
# END: Contimo integration

Example:

.htaccess
# BEGIN: Contimo integraton
RewriteEngine On
RewriteRule ^advertorials/(.*)$ contimo.php?websiteId=63ac46935c83c5212576f699&contimoToken=z61ma1721n&uri=$1 [L]
# END: Contimo integration