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 :)!
答案 0 :(得分:0)
我认为你需要编辑你的htaccess:
在RewriteEngine On行的正下方,添加:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
希望这能解决您的问题。
答案 1 :(得分:0)
转到设置>>永久链接>>定制结构 并在自定义结构中添加" /"在末尾。 这将有效
答案 2 :(得分:0)
在.htaccess的RewriteEngine On行的正下方,添加
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R]
答案 3 :(得分:0)
尝试将此添加到您网站根目录中的.htaccess。
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
答案 4 :(得分:0)
我在index.php文件中添加了这段代码。没关系;)
SELECT * FROM department where id in(getChildDepartment(1))