The Z-Blog program is developed based on the IIS+asp environment. In theory, it cannot run in the Apache+php+MySQL environment. However, sometimes due to certain circumstances, Z-Blog needs to be temporarily migrated to the Apache platform. This article will describe it. specific form of migration.
The idea of migration is to make all Z-Blog static, and use PHP code to call back the address on the ASP server for the dynamic part. The database is still placed on the ASP server, using dual domain names, and using the FTP tool to transfer the address on the ASP server. Copy the HTML file to the PHP server.
The Z-Blog system needs to use the "static homepage generation plug-in", so that the homepage and article pages implement static HTML files. The category pages and tag pages are originally dynamic, which is troublesome to modify. The Z-Blog source code needs to be modified.
The modification method is to first create a cat directory, copy the catalog.asp file in the root directory, change it to default.asp, and modify the include path inside.
Next, modify the c_system_base.asp, c_system_event.asp, c_system_lib.asp files in the FUNCTION directory, search and replace "catalog.asp" with "cat/", so that the catalog page and category page will call the cat directory instead of the asp file.
After that, FTP all the HTML to the Apache host. For the cat directory, create an index.php file with the following content:
<?php
$qstring = isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : "";
$url = " http://www.williamlong.info/cat/?".$qstring ;
$file=file_get_contents($url);
echo $file;
?>
In this way, calls to the directory page and category page will automatically capture the files on the original ASP server.
Finally, edit the .htaccess file on the Apache server with the following content:
RewriteEngineOn
RewriteBase/
RewriteRule ^upload/(.*)$ http://www.williamlong.info/upload/$1 [R=301,L]
RewriteRule ^download/(.*)$ http://www.williamlong.info/download/$1 [R=301,L]
RewriteRule ^function/(.*)$ http://www.williamlong.info/function/$1 [R=301,L,QSA]
After such processing, the blog generated by Z-Blog can also be browsed in the Apache environment.
However, there are still some problems, mainly including: the comment function cannot be used (using another plug-in alone can barely support comments), the dynamically loaded content in the sidebar cannot be displayed, the number of article views cannot be counted, the rating plug-in is invalid, and updates are more troublesome.
The current method of updating the blog is to modify the hosts file, point the Z-Blog domain name to the original ASP server again, add articles, and then FTP to the Apache server. Originally, I considered installing Dropbox on both servers at the same time to achieve synchronization. , but later discovered that some foreign virtual hosts have begun to prohibit running Dropbox on the host. Their systems will automatically detect the Dropbox process and send emails to warn users, saying that running this program violates their policies and requires the process to be stopped, so they can only consider Use automatic FTP method to achieve synchronization.