How do I make my particular WordPress public?

Let’s assume you’ve installed WordPress as described here, directly in a folders named 816 under your xampp/htdocs/, and this, without any alterations (modifying settings or any configurations to neither your xampp nor WordPress installation); having defined the nameservers of your domain name (here, example.com) to point to your IP, let’s say: 192.182.230.1,

The following apply (when your xampp is up and running with Apache and MySQL started):

  • Visiting example.com in your browser should redirect you to example.com/dashboard/

  • Visiting example.com/816 in your browser should take you to your WordPress installation.

As such, if you’ve installed your WordPress by accessing localhost/816 in your browser, example.com/816 will redirect you to http://localhost/816, the actual location where your you’ve installed your WordPress site.

Should you have done so using your IP in place of localhost, I guess example.com/816 should redirect you to 192.182.230.1/816.

In order for example.com/816 to remain unchanged and point directly to your WordPress installation, you can do so by accessing your WordPress administration panel, then, head over to your Settings -> General; there, modify your WordPress Address (URL) and your Site Address (URL) from their current (either http://localhost/816 or http://192.182.230.1/816) states to http://example.com/816 and do remember to click on the Save Changes button so as to effect your modifications.

Should you want to access your WordPress site directly on example.com instead of example.com/816, you will have to set up a virtual host in order to achieve that.

Setting up a virtual host requires you edit your httpd-vhosts.conf file. You can locate it in your xampp/apache/conf/extra/ directory.

You can make use of the snippet below to set up your virtual host by adding it to your httpd-vhosts.conf file.

Do remember to save it, then, restart Apache so as to enable the change you just made take effect.

# VirtualHost for example.com
# Here, it is assumed your xampp was installed directly
# at the root of the drive C of your computer, in a folder named xampp.
<VirtualHost example.com:80>
    DocumentRoot "C:\xampp\htdocs\816"
    ServerAdmin example.com
    <Directory "C:\xampp\htdocs\816">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

After setting up your virtual host as described above, you can now go to your WordPress Dashboard Settings -> General, then, define example.com as your WordPress Address (URL) and your Site Address (URL); this will enable you to always access the content of your WordPress site directly on your domain name, example.com.