If WordPress is installed in the root directory (www / public_html) and you want all files to be moved to a subdirectory (but the structure / format of the links to remain the same), we recommend that you follow the steps below.

In other words, you can install the site in a subdirectory in the form http://websitename.tld/subdirectoryname and it should be visible as http://websitename.tld, the site files being in a subdirectory.

Log in with an FTP client; alternatively, you can use the File Manager available in cPanel.

  1. Create the desired subdirectory
  2. From the WordPress administration panel of the active website in Settings-> General Settings
  3. In the WordPress address (URL) box, set the new path http://domainname.tld/directoryname
  4. In the Site address (URL) box, set the URL http: //domainname.tld and click the Save Changes button
  5. Move files from public_html  to the created subdirectory (in our case /subdirectoryname)
  6. Now copy the index.php files and the .htaccess file from the subdirectory to www / public_html (attention! Those 2 files must be copied, not moved!)

The .htaccess file is usually hidden; if you view the files using the File Manager application in cPanel, please make sure you have the show hidden files option checked. If you do not have permalinks set in WordPress, the .htaccess file may not be created.

If you are running WordPress on a Windows server, instead of the .htaccess file you have a web.config file. For the index.php file the instructions remain the same (you will have to copy from the subdirectory to the root) and the web.config file must be moved to the root directory.

7. From File Manager or FTP client - open the index.php file and change the next line:

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

in

require( dirname( __FILE__ ) . 'numesubdirector/wp-blog-header.php' );

Log in to the WordPress admin panel at: http://domainname.tld/directorubname/wp-admin

If you receive errors on the inside pages, go to Settings> Permalinks and click the Save Changes button.

 

If you encounter problems in applying the above instructions please contact us. HostX offers the best WordPress hosting service and can help you solve your problems.

Cette réponse était-elle pertinente ? 0 Utilisateurs l'ont trouvée utile (0 Votes)