How To Set WordPress URL and Site URL Separately
Today’s goal is to set site address and WordPress address different. For example, the WordPress address is “example.com/admin” if the site address is “example.com”.
What are WordPress address and site address?
On the Settings -> General screen in a single site installation of WordPress, there are two fields named “WordPress Address (URL)” and “Site Address (URL)”.from Changing The Site URL in wordpress.org
The “Site Address (URL)” setting is the address you want people to type in their browser to reach your WordPress blog.from Changing The Site URL in wordpress.org
The “WordPress Address (URL)” setting is the address where your WordPress core files reside.
Why should they be different?
WordPress has core directories such as “wp-admin” WordPress Address. The sub directory enables to mange WordPress core directories cleanly aside from normal contents of the blog such as images and text.
And it prevent people access wp-admin directly where a dashboard to edit blog is.
*I will not bear any responsibility whatsoever for this method.
1. Change the site address on WordPress
Open “Settings” menu on WordPress Dashboard. Change Site Address. (It is better to install WordPress at www/admin directory on the server first and not to change WordPress Address.)
2. Download index.php and .htaccess
Download index.php and .htaccess from WordPress directory on the server.
3. Change index.php
Change require__DIR__ in index.php as below.
//before /** Loads the WordPress Environment and Template */ require __DIR__ . '/wp-blog-header.php';
//after /** Loads the WordPress Environment and Template */ require __DIR__ . '/admin/wp-blog-header.php';
4. upload index.php and .htaccess
Upload index.php and .htaccess to the site directory on the server.
5 Logout and Login again
To solve the problem that posts couldn’t be previewed, Logout and Login again.