如何在Wordpress中的URL端添加“/”

I have a problem with my Wordpress site. I have duplicate content on my site because my Wordpress showing up pages with "/" and without "/". How can i change it to this: when on page we don't have "/" on URL end then please redirect to version with "/". E.g: if adress is www.web.com/page please redirect to www.web.com/page/ Thanks for help :)!

I think you need to edit your htaccess :

Right below the RewriteEngine On line, add:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301] 

Hope this will solve your problem.

Go to Settings >> Permalinks >> Custom Structure and in custom structure add "/" at the end. This will work

Right below the RewriteEngine On line in .htaccess, add

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R] 

Try to add this to .htaccess in the root of your site.

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

I added to index.php file this code. It's ok ;)

if (substr($_SERVER['REQUEST_URI'], -1) != "/") {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: '.$_SERVER['REQUEST_URI'].'/');
    die;
}

</div>

https://www.mybj123.com/4683.html

看看这个能否帮到你