Give WordPress It’s Own Directory

Hi my friends. So for some of us, the time that we need to or we wanted to move our wordpress installation to its own directory has come. Therefore we will give WordPress It’s Own Directory.Many people want WordPress to power their website’s root (e.g. http://example.com). Opposite they don’t want all of the WordPress files cluttering up or load their root directory.

WordPress allows you to install it into a subdirectory, while having your website served from the website root. Maybe another reason is to run multiple sites or blog, especially if you have the GrowBig or GoGeek Siteground Hosting Plans or else’s provider Pro plans. So we need to give wordpress it’s own directory to separate each site’s files and folders. Same, a possible reason is that we had an html or static website website and we needed to convert it to a dynamic one. One with a flexible and user friendly CMS like wordpress. This was our case in which we needed to convert our customer’s website ( http://cloudu.gr – Cloud-U Telecoms) to WordPress without also interrupt the server from providing to clients the old one.

Now let’s concentrate in the process. We need to do some essential things to make our sites run properly. Otherwise every try will end up to be a mess.

Needless to say that if we just try to move our files and folders  we will have failed of course and unfortunately too. Just see what happened when we just copied our new WP files to the new directory.Give WP its own directory

Our URL in the above picture was http://cloudu.gr/wp/  where  wp was the new directory though. You can see the problem. No page can be found. Also when clicked at some specific page we were redirected to the root folder(below). Everything was a mess as a result.

Give WP its own directory and modify htaccess

Let’s fix the problem now.

1.Fist of all Copy  the code below as also seen in WP’s official site. (Note that there are two different ways. We would rather strongly insist you to choose FIRST one as we did too.Because it’s simpler while faster.)

 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>

 

2. Navigate to cPanel -> File Explorer -> public_html . Choose or click .htaccess  file and then Edit  as shown above.

Give-Wordpress-It's-Own-Directory

 

3. Replace  every  “example.com”  with your own specific domain name. Also replace  every  “my_subdir”  with your unique specific directory name placed under the public_html location. (DOMAIN REPLACEMENTS : 2  , MY_SUBDIR : 3 ).

 

IN CONCLUSION : DO NOT FORGET TO SAVE EVERYTHING AND RELOAD SERVER. 

-SAVE is placed in the upper and right edge of the editor.

-RELOAD is placed under and at the left side of Edit.

 

WPMO tip : If you don’t have, you lack or by mistake  deleted .htaccess file don’t worryy. You can either download it pressing here and upload it to the public_html folder of your server. Also you can create it in a text editor. For more press HERE  and do it so.

Comments 1

  • Howdy very nice website!! Man .. Beautiful .. Amazing ..

    I will bookmark your web site and take the feeds additionally?
    I’m happy to find a lot of helpful info here
    within the publish, we need work out more strategies in this regard, thank
    you for sharing. . . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *