WordPress: How to Remove the directory name in the link

When we put the WordPress program in the root of the space in the form of a folder, we need to add the name of the folder when visiting the website http://www.xxx.com/wordpress , you can’t access it by using the domain name directly. The solution is as follows:

1. First of all, in the program (in/var/www/HTML/WordPress), the“ index.php ”Copy a copy to the root directory of the website (/ var/www/HTML), and then open it. The default format is as follows:

require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );

2. In fact, we just need to add the folder name of your program to the path

example:

require( dirname( __FILE__ ) . ‘./wordpress/wp-blog-header.php’ );


Generally, you can go to the previous step to perform the third step.

If you find that the site opens blank after saving, just change the above sentence to the following:

require(‘./wordpress/wp-blog-header.php’);

3. After saving, you can open the program by directly accessing your domain name

But after such modification, when you open a page in the website, there is WordPress in the address bar. You need to make the following modifications:

To the installation background of WordPress, in the general settings

In the “site address (URL)” column, remove the WordPress after the address, as follows:

WP in database_ Make corresponding changes in options:
change to the following form

Siteurl:  http://xxx.xxx.xxx/wordpress
Home:  http:/xxx.xxx.xxx/

Reference 1
reference 2

Read More: