当サイトのように、自宅サーバーなどでダイナミックドメインで運用している場合、複数のドメインでアクセスできるようにする方法です。
$_SERVER["HTTP_HOST"]を上手く使います。
// XOOPS Virtual Path (URL) // Virtual path to your main XOOPS directory WITHOUT trailing slash define("XOOPS_URL", "http://".$_SERVER["HTTP_HOST"]."/xoops");
これで、トップページから移動してもドメイン部分が変わることなく移動できます。
しかし、キャッシュを有効にしていると、以前キャッシュされたデータが表示されるので、キャッシュデータのドメイン部分を削る必要があります。
2278行目あたりの
// prepend the cache header info into cache file
の前に以下を挿入します。
// It corresponds to a multi-domain by nao-pon $results = preg_replace("/(<[^>]+(href|action|src)=(\"|'))https?:\/\/".$_SERVER["HTTP_HOST"]."(:[\d]+)?/i","$1",$results);
このようになります。
// It corresponds to a multi-domain by nao-pon $results = preg_replace("/(<[^>]+(href|action|src)=(\"|'))https?:\/\/".$_SERVER["HTTP_HOST"]."(:[\d]+)?/i","$1",$results); // prepend the cache header info into cache file $results = serialize($this->_cache_info)."\n".$results;
これで、問題なくアクセスできるようになります。
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |