WordPress slug expects two directory in the page URL

  apache, mod-rewrite, nginx, php, wordpress

Website 1 : example.com

Website 2 : example.com/product – WordPress hosted on a separate machine

NGINX setting on a different machine used for reverse proxy –

server {
    listen 443 ssl;
    server_name example.com;
    ssl on;

location / {
    proxy_pass https://10.110.7.5:1100;
   }

   location /product/ {
    proxy_pass http://10.110.5.20/;
   }
}

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

example.com/product/slug – working. Nginx working fine

example/product/product/slug – it is working with double "product" as well – which is not required how to remove that?

Also if the slug URL starts with a product then it says 404

For example – example.com/product/product-details – Not working because slug has a product keyword

Source: Ask PHP

LEAVE A COMMENT