在单独的子目录中为具有Wordpress和主题文件的站点设置本地环境?

时间:2016-11-12 01:37:41

标签: php wordpress .htaccess testing configuration

我在这里完全失败了。我从未在单独的子目录中看到使用wp-content文件和wordpress安装文件的Wordpress站点设置。这是根目录的快照,因此您可以看到文件目录。 content文件夹包含父主题和子主题,wp文件夹包含wordpress安装。

snapshot of directory

我使用MAMP作为我的本地环境,我通过SFTP抓取了实时网站文件。直接的根目录是.htaccess文件,local-config.phpwp-config.php。对于我的本地设置,我想在localhost:8888/{ project name }托管此站点,但是配置文件没有为我连接。

这是local-config.php包含的内容:

<?php

 /* This is a sample local-config.php file In it, you *must* include
 the four main database defines

 You may include other settings here that you only want enabled on your
 local development checkouts
 */

 // Must have a trailing and leading slash // define('WP_SUBURI',
 '/mysite/');

 define( 'DB_NAME', 'icecreamstore_wp' ); define( 'DB_USER', 'root' );
 define( 'DB_PASSWORD', 'root' ); define( 'DB_HOST', 'localhost' );

 // Comma separated list of hostnames which should be considered
 "local" // and re-written to $_SERVER['HTTP_HOST']. Also addresses
 wp-content => content replacement. define( 'PATHFIX',
 'local.icecreamstore.maine.edu, icecreamstore.maine.edu'
 );

 // WP_ENV sets the environment to be used by the wp-env MU plugin //
  defined( 'WP_ENV', 'development' );

 // Maintenance mode using the maintenance mu-plugin // define(
 'MAINTENANCE', false); // define( 'MAINTENANCE', true); // define(
 'MAINTENANCE', '<h1>Custom message</h1><p>For maintenance mode</p>');

 // $table_prefix = 'wp_';

 // If the keys are defined here, they will not be loaded in
 wp-config.php

 { security and authentication below this line... }

wp-config.php网站包含:

 <?php
 // ===================================================
 // Load database info and local development parameters
 // ===================================================
 if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
   include( dirname( __FILE__ ) . '/local-config.php' );
 }

 // ========================
 // Security
 // ========================
 if ( !defined('DISALLOW_FILE_EDIT') )
   define('DISALLOW_FILE_EDIT', TRUE);
 if ( !defined('DISALLOW_FILE_MODS') )
   define('DISALLOW_FILE_MODS', FALSE);

 // ========================
 // Custom Content Directory
 // ========================
 define('WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );

 if ( !defined('WP_SUB_URI') )
   define('WP_SUBURI', '/');

 define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI   . 'content' );

 /** dynamically set siteurl and home options */
 define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI . 'wp');
 define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI);

 { security and authentication below... }

如果它有帮助,根目录中的.htaccess包括:

 # BEGIN WordPress
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

 # END WordPress

帮助!我没有在网上找到这个特殊问题的人,不得不以这种方式设置实时网站,并创建一个本地环境进行测试。缺点:之前的开发人员没有在README.md文档中包含任何内容。

0 个答案:

没有答案