Skip to content

Instantly share code, notes, and snippets.

@Kevinlearynet
Last active August 17, 2021 18:59
Show Gist options
  • Select an option

  • Save Kevinlearynet/2f3d327d6c3c32e42a9f221822726761 to your computer and use it in GitHub Desktop.

Select an option

Save Kevinlearynet/2f3d327d6c3c32e42a9f221822726761 to your computer and use it in GitHub Desktop.
Folderwave server setup related files
<?php
/**
* FW Connector Config
*
* Add this to: /wordpress/wp-content/mu-plugins/fw-config.php
*/
$host = $_SERVER['SERVER_NAME'];
$api_host = ($host === 'student.student-1.com') ? 'https://www17.student-1.com' : 'https://www46.student-1.com';
if (!defined('FW_ENV')) {
if ($host === 'student.student-1.com') {
define('FW_ENV', 'prod');
} elseif ($host === 'studenttest.student-1.com') {
define('FW_ENV', 'test');
} else {
define('FW_ENV', 'local');
}
}
if (!defined('APIHOST')) {
define('APIHOST', $api_host);
}
if (!defined('APIPATH')) {
$namespace = FW_ENV === 'prod' ? '_Live' : '_Test';
define('APINAMESPACE', APIHOST . "/VBRestServiceFWPath$namespace");
define('APIPATH', APINAMESPACE . "/RestServiceImpl.svc/");
}
if (!defined('CALL_FW')) {
define('CALL_FW', 'RldBVkVcTUVGQVN0dWRlbnRTZXJ2aWNlc1U6ODR4NFY3');
}
if (!defined('PORTAL_DIR')) {
if (FW_ENV === 'prod') {
define('PORTAL_DIR', "E:/Program Files/Folderwave/FWPathPortal_Live");
} elseif (FW_ENV === 'test') {
define('PORTAL_DIR', "E:/Program Files/Folderwave/FWPathPortal_Test");
} else {
define('PORTAL_DIR', WP_CONTENT_DIR . '/uploads/tmp');
}
}
if (!defined('PORTAL_URL')) {
if (FW_ENV === 'prod') {
define('PORTAL_URL', "$api_host/FWPathPortal");
} else {
define('PORTAL_URL', str_replace('https://', 'http://', "$api_host/FWPathPortal_Test"));
}
}
// Debugging
if (isset($_GET['config-test'])) {
echo '<h2>Configuration Test</h2>';
echo '<pre>';
echo 'APIHOST: ' . APIHOST . PHP_EOL;
echo 'APIPATH: ' . APIPATH . PHP_EOL;
echo 'FW_ENV: ' . FW_ENV . PHP_EOL;
echo 'CALL_FW: ' . CALL_FW;
echo '</pre>';
exit;
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="WordPress" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{HTTP_HOST}" pattern="studenttest.student-1.com" />
</conditions>
<action type="Rewrite" url="/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment