You’ve just spun up a small web app and you’re ready to make it available on the internet. Maybe its just a tiny utility that doesn’t really necessitate its own subdomain. Perhaps you just need to make this tool available to an internal team and get it running quickly.
You may wonder if you can use the same domain you are already using for your WordPress site. Can it be done without modifying .htaccess
files, Apache configs, or your DNS settings?
Luckily, the answer is yes, and it’s pretty easy!
First, enter the directory that contains your WordPress site:
cd /var/www/my-wp-site
Next, create a symbolic link from the WordPress directory to the directory containing your web app:
ln -s /path/to/your/app ./my-new-app
Replace my-new-app
with the name you would like to use for the link. This will then be used in the URL path to access your app. For example, jonahcamp.com/my-new-app
.
Note: Apache will prioritize this over any WordPress pages with the same slug, so make sure you are using a unique name that doesn’t overlap any of your pages/posts!
You can combine the steps above into a one-liner, too:
ln -s /path/to/your/app /var/www/my-wp-site/my-new-app
Now your entire web app will be available behind your WordPress site’s domain!