D
D
Dmitry Markov2019-08-12 15:43:10
WordPress
Dmitry Markov, 2019-08-12 15:43:10

How to remove cnc appending?

There are 2 pages
site.com/news-avto
site.com/avtomobili-s-probegom
If I enter such a request site.com/avtomobili I will get not a 404 page, but site.com/avtomobili-s-probegom. How to disable cnc auto-completion? Site on wp
Here is the nginx config

server {
  server_name  site.com www.site.com;

  root /var/www/vhosts/site.com/httpdocs;
  index index.php;
  include /etc/nginx/sites.conf.d/global.conf;

  error_log /var/www/vhosts/site.com/log/error.log error;
  access_log /var/www/vhosts/site.com/log/access.log combined;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php-fpm--site.com.sock;
  }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/site.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/site.com/privkey.pem; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

The problem is the following
When I do a 301 redirect
rewrite ^/avtomobili/$ https://site.com/news-auto/ permanent;
site.com/avtomobili still leads to site.com/avtomobili-s-probegom.
It seems to me that this is due to the fact that the url is autocompleted. I can't figure out where this is happening and how to turn it off.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2019-08-12
@En-Tilza

When I do a 301 redirect
site.com/avtomobili still leads to site.com/avtomobili-s-probegom.

In the template, the address ends in a slash ^/avtomobili/$, but in the request, do not add a slash.
You need to change the template to ^/avtomobili$or^/avtomobili/?$

V
Viktor Taran, 2019-08-12
@shambler81

try_files $uri $uri/ /index.php?$args;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question