Rajan Gupta
rajangpt.bsky.social
Rajan Gupta
@rajangpt.bsky.social
Freelance WordPress Developer Check it out 👉 https://rajangupta.com/
Absolutely agree — building is the fun part! 🎯
Managed WordPress hosting really takes the stress out of the day-to-day tasks like updates, security patches, and backups.
May 8, 2025 at 4:11 AM
💡 Lesson: When working in a subfolder install, never assume $_SERVER['REQUEST_URI'] can be directly appended to site_url() or home_url().

📩 If you're facing something similar, drop a comment or DM me — happy to share the solution!
May 8, 2025 at 4:09 AM
✅ The fix involved:

Stripping the subdirectory prefix from the request URI

Carefully rebuilding the URL using site_url()

Adjusting .htaccess rewrite rules

Flushing permalinks for good measure
May 8, 2025 at 4:09 AM
Why?
Because WordPress was installed in /us/blog/, and the redirect logic was unintentionally adding the subdirectory twice.

🔍 The culprit? Using site_url($_SERVER['REQUEST_URI']) without trimming the base path.
May 8, 2025 at 4:09 AM