One option is to explicitly move the wp-content folder one level up so it resides at /public_html/wp-content
by defining WP_CONTENT_DIR
in wp-config.php
.
For this I’d recommend something more like the second method described in Giving WordPress Its Own Directory. Editing wp-config.php has an example for the WP_CONTENT_DIR
change.
The resulting directory structure (relative to public_html
would look like this:
- .htaccess
- index.php
- wp-content
- ...
- example
- wp-admin
- wp-includes
- ...
Bonus:
You can use a .htaccess
file similar to this one:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) example/$1 [L] # your WP folder
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]
This way you can set both Home URL and Site URL to https://example.com
(without /example
, so it won’t be clear at first glance that WordPress is installed in a subfolder. You can then log in via https://example.com/wp-admin/
Such a setup is especially useful when using Composer, where WordPress is best installed in a subdirectory like described in Rarst’s Composer in WordPress guide.