最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - How do you modify the WordPress directory structure?

programmeradmin4浏览0评论

I would like to use the following directory structure for WordPress.

├── composer.json
├── config
│   ├── application.php
│   └── environments
│       ├── development.php
│       ├── staging.php
│       └── production.php
├── vendor
└── web
    ├── app
    │   ├── plugins
    │   ├── themes
    │   └── uploads
    ├── wp-config.php
    ├── index.php
    └── wp

I would like to use the following directory structure for WordPress.

├── composer.json
├── config
│   ├── application.php
│   └── environments
│       ├── development.php
│       ├── staging.php
│       └── production.php
├── vendor
└── web
    ├── app
    │   ├── plugins
    │   ├── themes
    │   └── uploads
    ├── wp-config.php
    ├── index.php
    └── wp
Share Improve this question edited May 11, 2020 at 10:30 Anonymous asked Jun 26, 2019 at 20:41 AnonymousAnonymous 231 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Looking at your proposed structure, I am assuming that the only thing that would be changed is:

  1. The WordPress files are all kept in a folder you've called web. For this just create a .htaccess file in root folder, and put this content inside (just change example):

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?example$
    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /web/$1
    RewriteCond %{HTTP_HOST} ^(www.)?example$
    RewriteRule ^(/)?$ web/index.php [L] 
    </IfModule>
    
  2. Rename the wp-content folder (I do not suggest doing this, as some plugins or themes may not work simply because they are not written using best practices and hard coded the folder name). In your wp-config.php put this:

    define( "WP_CONTENT_FOLDERNAME", "app" );
    

Now, if I am assuming that EVERYTHING else WP is in the directory WP, then things would change slightly, but that should give you an idea of how.

You can read more by looking at the WordPress support pages.

发布评论

评论列表(0)

  1. 暂无评论