Home > Help Center > Applications > WordPress > Install WordPress in its Own Directory

Install WordPress in its Own Directory

Create and configure new domain name:

wordpress directory

Create new MySQL database with user and password, grant all privileges to the user in the database.

In this article we are going to show you how you can install WordPress in its own directory, different than the domain root directory. We'll show you how to achive the same result using three different methods - by using SSH, Cpanel File Manager and FTP connection.

Using SSH

Download latest WordPress in domain root directory.

Untar the archive and rename wordpress to blog (if you like):

wordpress directory

Move (not copy) index.php from /blog to / (domain root directory) and create empty .htaccess file in the root directory:

wordpress directory

Paste the following code in .htaccess - it will enable WordPress to use permalinks:

`

BEGIN WordPress

<IfModule modrewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUESTFILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

END WordPress

`

Open index.php file and find the line of code:

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

Add the WordPress directory name /blog to the file path:

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

wordpress directory

Save the file.

Enter http://hostpulse-demo.net in your browser to start WordPress installation.

Login WordPress administration when the site is installed.

wordpress directory

In Settings > General:

Change WordPress Address (URL) to the new location of your main WordPress core files: http://hostpulse-demo.net/blog

Change Site Address (URL) to the root directory's URL: http://hostpulse-demo.net

wordpress directory

Click Save Changes.

In Settings > Permalinks:

Select different type permalinks:

wordpress directory

Click Save Changes.

Click Visit Site link at the top of the screen:

wordpress directory

Your WordPress site works fine from its own directory within domain root directory.

Using File Manager

  • Download latest WordPress from https://wordpress.org/download/
  • Open CPanel > File Manager and navigate to domain root folder.
  • Upload the WordPress archive.
  • Extract the arhive
  • Rename (if you want, it is not obligatory) WordPress directory name
  • Move index.php file from WordPress directory to domain root directory
  • Edit the line of code :
    require( dirname( __FILE__ ) . '/blog/wp-blog-header.php' );

  • Create New file .htaccess and paste the standard code in: `

BEGIN WordPress

<IfModule modrewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUESTFILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

END WordPress

`

You have to finish these steps having such file structure:

wordpress directory

where index.php and .htaccess files are edited according to the instructions.

Now install WordPress, login to administration and edit the URLs in Settings > General and Permalinks in Settings > Permalinks.

Save the changes and visit the site.

Using FTP

Follow the same pattern using FTP – the only difference is you must create new folder on your computer to extract the WordPress archive within.

Then move index.php and create new .htaccess file. Open and edit both files the exact same way shown above but using text editor on your computer (not MS Word).

wordpress directory

Using FTP upload the content of the containing folder to domain root folder, install WordPress in the browser, login administration and edit URLs and permalinks – just follow the exact steps that were explained earlier in the article.

Save the changes and visit the site.

#wordpress #installation

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support