1

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
    │   ├── mu-plugins
    │   ├── plugins
    │   ├── themes
    │   └── uploads
    ├── wp-config.php
    ├── index.php
    └── wp
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.com):

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /web/$1
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    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.

  • Thank you. I assume this would work in Nginx as well? – Anonymous Jun 29 at 4:29
  • I don’t know I’ve not tried, but I assume so. – Nathan Powell Jun 30 at 13:22
  • Did this answer work for you @Anonymous? – Nathan Powell Jul 1 at 13:58
  • No. I am using Nginx. – Anonymous Oct 20 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.