To set up WordPress in a subdirectory (e.g., while keeping your main Angular SPA website at the root domain (, follow these steps:

1. Backup Your Current Website and Database:

Always ensure you have complete backups of both your website files and your database before making significant changes.

2. Install WordPress in a Subdirectory:

  1. Create a subdirectory: In your website's root folder (where your Angular app resides), create a new folder called blog.

  2. Upload WordPress: Download the latest version of WordPress from the official website. Unzip it and upload all its files to the blog folder using FTP or any other file management tool you prefer.

  3. Install WordPress: Access the WordPress setup by visiting and follow the on-screen prompts to set up WordPress.

3. Adjust WordPress Settings:

  1. Change the site address: Once you have installed WordPress, log in to the admin dashboard. Go to Settings > General.

    • WordPress Address (URL):
    • Site Address (URL):

    Save the changes.

4. Update Your Angular SPA Configuration:

You may need to ensure that any routing in your Angular app doesn't conflict with the /blog endpoint.

  1. Update .htaccess for Angular: If you're using an .htaccess file for your Angular app to handle routing, make sure it allows the /blog endpoint to be processed by WordPress. An example .htaccess that integrates both the Angular app and WordPress might look like this:

    RewriteEngine On
    # For the Angular App
    RewriteCond %{REQUEST_URI} !^/blog
    RewriteRule . /index.html [L]
    # Let WordPress handle its endpoints
    RewriteCond %{REQUEST_URI} ^/blog
    RewriteRule ^blog/(.*)$ /blog/index.php [L]

5. Migrate Content from the Subdomain:

If you have existing content on, you'll need to migrate it.

  1. Export content from the old blog: On, go to Tools > Export in the WordPress dashboard to download an XML file of all your content.

  2. Import content to the new blog: On, go to Tools > Import, install the WordPress importer if prompted, then upload the XML file you just downloaded.

6. Redirects:

To maintain SEO rankings and ensure that visitors accessing the old blog URLs get redirected to the new location, you should set up 301 redirects from to

  1. Using .htaccess: If both sites are on the same server, and you're using Apache, you can set up a .htaccess redirect like this:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^blog\.acmecorp\.com$
    RewriteRule ^(.*)$$1 [R=301,L]
  2. Using a WordPress Plugin: If you prefer, you can use plugins like "Redirection" on the old site to manage the redirects.

Lastly, don't forget to update any internal or external links pointing to to reflect the new URL structure, and monitor for any 404 errors to ensure a smooth transition.

Setup WordPress on a Subdirectory with Angular SPA and Apache