If your .htaccess redirects aren't working for specific directories, or a folder keeps redirecting to the wrong place, it may be caused by the nginx reverse proxy that runs in front of Apache on our servers. Nginx handles static files and caching, while Apache handles PHP and .htaccess rules. In some cases, nginx intercepts a request before Apache sees it, bypassing your .htaccess rules.
Your .htaccess Redirect May Be Bypassed by Nginx
Our servers use nginx as a reverse proxy in front of Apache. If a redirect isn't working:
- Static files (images, CSS, JS) are served by nginx, which doesn't read .htaccess
- PHP requests go through Apache, where .htaccess rules work normally
- Contact support if you need a redirect applied at the nginx level
01. How Nginx + Apache Work Together
Our servers run a dual-layer web server architecture:
- Nginx (front layer) - handles incoming connections, serves static files (images, CSS, JS, HTML), SSL termination, and caching
- Apache (back layer) - handles PHP processing, .htaccess rules, and dynamic content
When a visitor requests a page, nginx checks if the request is for a static file. If so, nginx serves it directly without involving Apache. If the request needs PHP processing, nginx passes it to Apache, which reads .htaccess and processes the request.
This is why .htaccess redirects work for PHP pages but may not work for static files or directory-level redirects.
02. Common Redirect Issues
Directory Redirect Not Working
If you have a redirect in .htaccess for a directory (e.g., /old-folder/ to /new-folder/) and the directory contains an index.html, nginx may serve the index.html directly without consulting Apache's .htaccess.
Subdomain or Folder Pointing to External Server
If you want a folder like yourdomain.com/app/ to proxy to a different server, .htaccess ProxyPass directives won't work on shared hosting. This requires server-level nginx configuration.
Redirect Loops
If both nginx and .htaccess try to redirect the same URL, you can get infinite redirect loops. This shows as a "too many redirects" error in the browser.
03. How to Fix
For PHP-Based Redirects (Most Cases)
If the redirect involves PHP pages (WordPress, etc.), .htaccess works normally. Make sure your redirect rules are correct using our .htaccess guide or redirect guide.
For Static File or Directory Redirects
If .htaccess redirects aren't being applied to static files or directory URLs, open a support ticket. We can add the redirect at the nginx level, which takes priority over everything.
For Redirect Loops
Check for conflicting redirects in:
- Your .htaccess file (may have duplicate or circular rules)
- cPanel > Domains > Force HTTPS Redirect (may conflict with .htaccess HTTPS redirect)
- WordPress Settings > General (site URL mismatch)
- Cloudflare (if using "Always Use HTTPS" on top of server-side redirect)
Need a Server-Level Redirect?
If your redirect requires nginx configuration, open a ticket with the source URL, destination URL, and redirect type (301 permanent or 302 temporary).
Open a Support TicketFrequently Asked Questions
Why are my .htaccess redirects not working on UWH hosting?
Our servers run an nginx reverse proxy in front of Apache. Nginx serves static files and caching while Apache handles PHP and .htaccess. For some requests nginx answers before Apache sees them, so an .htaccess redirect never runs. This mostly affects static files and cached responses rather than PHP-handled URLs.
How do I fix an .htaccess redirect that nginx is bypassing?
Route the request through Apache so your rule runs, for example by redirecting at the application level or ensuring the URL is handled by PHP rather than served as a static file by nginx. Clearing the nginx cache after changing rules also prevents an old response from masking the fix.
Does nginx caching cause redirects to behave inconsistently?
Yes. If nginx has cached a response, it can keep serving the old version after you change an .htaccess rule, so the redirect appears to work intermittently. Purge the nginx cache for the account after editing rules and retest in a private window.
How do I know whether nginx or Apache is handling my request?
Static files such as images, CSS, and JavaScript are typically served by nginx, while PHP pages go to Apache where .htaccess applies. If a redirect works for a PHP URL but not for a static path, nginx is intercepting the static request before Apache and its .htaccess rules.
Quick Recap
- Nginx serves static files, Apache handles PHP - .htaccess only affects Apache requests
- PHP page redirects work in .htaccess - no changes needed
- Static file/directory redirects may need nginx config - contact support
- Redirect loops - check for conflicting rules in .htaccess, cPanel, WordPress, and Cloudflare
- ProxyPass not available - requires VPS or server-level configuration
Last updated November 2026 · Browse all htaccess articles · See also: .htaccess Guide | 302 Redirects
