Change Wordpress Admin URL Without Core Directory
You've restructured your WordPress installation to separate core files into a dedicated wordpress directory while keeping plugins and themes in a content folder. This is a sound architectural choice that improves security by isolating the most frequently targeted components of the CMS. However, it has introduced a friction point: you can no longer access the admin dashboard via the standard /wp-admin/ path relative to your document root. Instead, every request must be prefixed with /wordpress/, resulting in URLs like http://site.dev/wordpress/wp-admin.
If your goal is to maintain the clean URL structure of http://site.dev/wp-admin while keeping the core files in their subdirectory, you need to understand how WordPress resolves paths and where the configuration limits lie. The short answer is that there is no simple setting in wp-config.php that decouples the physical location of the core files from the logical URL path used by the admin interface.
WordPress relies heavily on the ABSPATH constant (which defaults to the directory containing wp-config.php) and the WP_CONTENT_DIR/WP_CONTENT_URL definitions you have in place. When you define WP_SITEURL and WP_HOME, you are telling WordPress where the site is accessible from, but these variables do not override the internal filesystem path resolution for the admin scripts themselves. The wp-admin folder is a physical directory inside your wordpress folder. When a browser requests /wp-admin, Apache or Nginx attempts to serve files from /www/htdocs/wp-admin. If your actual files live at /www/htdocs/wordpress/wp-admin, the server will return a 404 error unless you intercept the request and map it correctly.
This is where .htaccess becomes the primary tool for resolution. You cannot achieve this purely through PHP configuration because the web server needs to know how to locate the files before PHP even executes. You must add rewrite rules to your root directory's .htaccess file (or your virtual host configuration) to alias the /wp-admin/, /wp-login.php, and any other core paths to their actual locations within the wordpress subdirectory.
A minimal implementation for an Apache environment would look like this in your root .htaccess:
RewriteEngine On
# Redirect /wp-admin requests to /wordpress/wp-admin
RewriteRule ^wp-admin/ wordpress/wp-admin/ [L]
# Redirect wp-login.php to the correct location
RewriteRule ^wp-login\.php$ wordpress/wp-login.php [L]
# Ensure other core paths like xmlrpc.php or upgrade-*.php are handled similarly if needed
RewriteRule ^([^.]+)\.xmlrpc\.php$ wordpress/$1.xmlrpc.php [L]
This approach allows you to keep the physical separation of files while presenting a flat URL structure to users and search engines. However, be aware of the implications. This method relies entirely on server-side rewriting. If you deploy your site using Git with multiple environments (e.g., dev, staging, prod), you must ensure that these rewrite rules are included in your deployment pipeline or applied via your hosting control panel's global settings.
Furthermore, while this solves the immediate access issue, it does not fully decouple the application from its physical location. If you ever decide to move the entire WordPress core into the document root without breaking the wp-content separation, you would need to adjust ABSPATH and potentially update the rewrite rules again. The trade-off here is maintaining a clean URL structure at the cost of adding complexity to your .htaccess configuration and ensuring that all edge cases (like XML-RPC requests) are covered by specific rewrite rules.
If you are managing multiple sites on a shared host, check if the provider offers a "WordPress Multisite" or "Application Manager" feature that allows you to define custom paths without touching server files. This is often safer than manual .htaccess edits. Ultimately, achieving the desired URL structure requires explicit path mapping at the web server level, as PHP configuration alone cannot resolve physical file locations outside the expected directory hierarchy.