[英]how can i remove trailing slashes form the url
I am having an issue with the trailing slashes at the end of the URL. 我在URL末尾有斜杠的问题。 I check the URL redirection online and the result shows me that I am having too many redirects on my page so I need to reduce those redirects I am having the following result of my link
我在线检查URL重定向,结果显示我的页面上有太多的重定向,所以我需要减少那些重定向,我的链接有以下结果
https://example.com/xyz/pqr
302 Found
https://example.com/xyz/pqr/
302 Found
https://example.com/xyz/pqr//
302 Found
https://example.com/xyz/pqr///
302 Found
https://example.com/xyz/pqr////
302 Found
https://example.com/xyz/pqr/////
302 Found
https://example.com/xyz/pqr//////
302 Found
https://example.com/xyz/pqr///////
302 Found
https://example.com/xyz/pqr////////
302 Found
https://example.com/xyz/pqr/////////
302 Found
https://example.com/xyz/pqr//////////
302 Found
https://example.com/xyz/pqr///////////
302 Found
https://example.com/xyz/pqr////////////
302 Found
https://example.com/xyz/pqr/////////////
302 Found
https://example.com/xyz/pqr//////////////
302 Found
https://example.com/xyz/pqr///////////////
302 Found
https://example.com/xyz/pqr////////////////
302 Found
https://example.com/xyz/pqr/////////////////
302 Found
https://example.com/xyz/pqr//////////////////
302 Found
https://example.com/xyz/pqr///////////////////
302 Found
how can i resolve this issue?? 我怎么能解决这个问题? i am having no idea where i am going wrong..!!
我不知道我哪里错了.. !! Any help would be aprpeciated.
任何帮助都是有意义的。 Thanks in advance.
提前致谢。
Here is my htaccess code : 这是我的htaccess代码:
RewriteEngine on
RewriteCond %{QUERY_STRING} p=3842
RewriteRule ^ /? [R=301,L]
That's all what i have in my htaccess code and the rest is just a 301 redirects and nothing more..!! 这就是我在htaccess代码中的所有内容,其余的只是301重定向,仅此而已...... !!
To remove a trailing slash using .htaccess
you can use: 要使用
.htaccess
删除尾部斜杠,您可以使用:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.