How to Run WordPress under Next.js? Subfolder SEO Guide in 2026

Veysel Okatan 25 March 2026
6 min read
How to Run WordPress under Next.js? Subfolder SEO Guide in 2026
Can Next.js and WordPress Work Together?

There is a famous myth circulating in the web development world: “If your main site runs on a modern technology like Next.js, you must install the blog section on a subdomain.”

It was with these thoughts that I began my blogging journey. My first move was to run my landing page on Cloudflare Pages to take a safer route at least, I wanted to avoid any ‘billing shocks’. Of course, at that point, since Cloudflare doesn’t support PHP, I couldn’t run my WordPress site (blog.getneotiler.com) there. For that, I chose to use a Hetzner VPS for fixed costs. However, after a while, I noticed something in my Search Console data and AdSense application: although these two sites were a whole, they stood quite apart in the eyes of Google.

Due to reasons like receiving a rejection for “low-value content” because I had to apply for AdSense via the main domain, and seeing that the traffic of one site did not boost the other in Search Console (the SEO juice wasn’t flowing), I decided to merge these two sites.

So, can WordPress be run in a subfolder (/blog) under Next.js? The answer: Absolutely yes, and this is the most professional method available.

Why Did We Switch from Subdomain to Subfolder ?

The biggest reason behind my decision to switch was the issue of SEO and Domain Authority:

  • Division of Power: Google tends to see subdomains (blog.domain.com) technically as a different shop, separate from the main site. The authority gained by high-quality content produced in the blog does not provide 100% benefit to your homepage; this is what I saw in my Search Console data.
  • Being a Single Piece: When you use a subfolder (domain.com/blog), Google accepts it as an organic part of the main site. Every million visitors or backlinks coming to your blog directly increases the “score” of the main domain and carries your main pages upward. This is why giants like HubSpot and Shopify use the /blog structure.
  • AdSense Guarantee: AdSense can give a “low-quality content” warning when there is no content on the main domain and only a redirection is made. This was exactly the problem I experienced.

How Did We Build the Architecture?

In order to run my Next.js landing page and my WordPress site on the same VPS, we needed a controller; for this, we installed Nginx.

The logic was simple:

  • If a visitor goes to getneotiler.com/blog, Nginx sends the traffic to the WordPress files running in the background.
  • For all other addresses (the main site), we had a system that passed the traffic to Next.js.

However, believe me, setting up this system was not as easy as it sounds here. Let me tell you about the problems we encountered.

Curve 1: Node.js Version Crisis and Resource Insufficiency

The first problem we encountered was somewhat server-related, and it wasn’t hard to solve. When I wanted to pull the project files from GitHub and build them, we couldn’t do it due to a Node.js version incompatibility. After updating the version, this time the RAM wasn’t enough. We completed this part after setting up Swap RAM. However, our next problem was even bigger.

Curve 2: Nginx 403 Forbidden and 404 Errors

After setting up the folder structures, we were getting 403 and 404 errors at the /blog address; Nginx couldn’t find WordPress’s index.php file. The Solution: We discovered that WordOps stores WordPress core files in the /htdocs/ folder, not directly in the main directory (by the way, I should mention that I was using WordOps when there was only WordPress on the VPS previously). We moved the wp-config.php file to the correct place and opened the gates by updating the alias path in the Nginx setting to .../blog.getneotiler.com/htdocs/; and adjusting the file permissions (chown -R www-data:www-data).

Curve 3: Redirection Loop and Cloudflare 521 Error

While launching the site via Cloudflare, we entered an infinite redirection loop. Cloudflare was talking to the server via HTTP, and WordPress was forcing HTTPS and sending it back. Later, when we switched Cloudflare to “Full” mode, the “521 Web Server is Down” error appeared. As a solution: We saw that only Port 80 was open in the Nginx configuration. We opened the secure gate by adding listen 443 ssl; to Nginx and introduced our Let’s Encrypt certificates’ correct file names (key.pem) to Nginx. Additionally, we broke the redirection loop by passing the fastcgi_param HTTPS 'on'; parameter to WordPress’s wp-config.php file.

Curve 4: CSP Blocking AdSense and Plugins

Just as I was getting tired of the problems, this time the Next.js security controls we previously defined for the main landing page appeared before me. At first, I thought, “Why is Next.js interfering with the WordPress part?” but it had become the main manager. Therefore, I had to review the rules again, and we solved this problem this way as well.

Curve 5: “Conflicting Server Name” Error

Even though we removed the old subdomain settings from Nginx, we were constantly getting conflict warnings. The Solution: When we scanned the server deeply, we found a “ghost” file named force-ssl-blog.getneotiler.com.conf that WordOps had automatically created and Nginx had secretly loaded. By deleting this file with the rm command, I was finally able to take a sigh of relief, thinking “I guess it’s over now” in a state of exhaustion.

And finally, since we didn’t want to lose our links that had been shared or indexed in many places before, we completed the process by setting up the 301 redirect system.

Conclusion: Next.js and WordPress Living in Harmony

It was a strange experience, but we successfully completed an operation that I felt I had to do and had been postponing for a while.

Why do I say strange? Because it involves two different technologies; on one side, Next.js as a latest-generation technology, and on the other, WordPress with PHP which has existed for many years… But it was a great experience to see this duo work together.

By the way, such systems are built, but the coexistence of two similar technologies (like a WordPress blog and XenForo forum software) is a much more common example. However, I think this type of experience (Next.js + WP) is not very popular. In this section, I wanted to share my experience with you. If anyone is wondering if it can be done: yes, it can.

Share:
Author

Veysel Okatan

I'm an economics graduate and engineering enthusiast who loves finding solutions to problems from my own perspective. I'm the creator of NeoTiler and a developer specializing in native macOS tools, custom WordPress themes, and high-performance plugins. This is also my blog. I'm not a news writer. I mostly write criticism, ideas, and experiences from my own point of view. Thanks.

See all posts

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