markdown 将WordPress移动到自己的目录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 将WordPress移动到自己的目录相关的知识,希望对你有一定的参考价值。

<h1>Using a pre-existing subdirectory install</h1>

<p>If you already have WordPress installed in its own folder (e.g., http://example.com/wordpress), then the steps are as follows:</p>

<ol>
  <li>Go to the General panel.</li>
  <li>In the box for <strong>Site address (URL):</strong> change the address to the root directory's URL. Example: http://example.com</li>
  <li>Click <strong>Save Changes</strong>. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)</li>
  <li><strong>Copy</strong> the index.php and .htaccess files from the WordPress directory into the root directory of your site. If you are not using pretty permalinks, then you may not have a .htaccess file.</li>
  <li>
    Edit your root directory's index.php.
    <ol>
      <li>Open your root directory's index.php file in a text editor</li>
      <li>Change the line that says: <br>
          <code>require( dirname( __FILE__ ) . '/wp-blog-header.php' );</code> <br>
          to the following, using your directory name for the WordPress core files: <br>
          <code>require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );</code></li>
      <li>Save the file.</li>
    </ol>
  </li>
  <li>Login to your site (if you aren't still already). The URL should still be http://example.com/wordpress/wp-admin/</li>
  <li>If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)</li>
  <li>Perform a search and replace on the <strong>wp_posts</strong> table.<br> 
    Use the full URL to wp-content. <br>
    <strong>Example:</strong> Search and replace http://example.com/wordpress/wp-content/ with http://example.com/wp-content/ </li>
</ol>

<br>
<hr>
<br>

<h1>Moving a Root install to its own directory</h1>

<p>The process to move WordPress into its own directory is as follows:</p>

<ol>
  <li>Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use "chown apache:apache" on the wordpress directory you created.)</li>
  <li>Go to the General panel.</li>
  <li>In the box for WordPress address (URL): change the address to the new location of your main WordPress core files. Example: http://example.com/wordpress</li>
  <li>In the box for Site address (URL): change the address to the root directory's URL. Example: http://example.com</li>
  <li>Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)</li>
  <li>Move your WordPress core files to the new location (WordPress address).</li>
  <li>Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file.</li>
  <li>Open your root directory's index.php file in a text editor</li>
  <li>Change the following and save the file. Change the line that says: <br>
  <code>require( dirname( __FILE__ ) . '/wp-blog-header.php' );</code> <br>
  to the following, using your directory name for the WordPress core files: <br>
  <code>require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );</code> </li>
  <li>Login to the new location. It might now be <code>http://example.com/wordpress/wp-admin/</code></li>
  <li>If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)</li>
</ol>

以上是关于markdown 将WordPress移动到自己的目录的主要内容,如果未能解决你的问题,请参考以下文章

将 wordpress 从 xampp 移动到 xampp

将 WAMP 和 Wordpress 移动到另一个驱动器

sql 将Wordpress移动到新域

将 Wordpress 从 MAMP 移动到 WAMP,无法访问页面

将 Wordpress 站点移动到 Docker:建立数据库连接时出错

如何将 wordpress 从 root 移动到 hostgator 上的新目录?