S
S
SlavaMorg2017-09-25 22:42:41
htaccess
SlavaMorg, 2017-09-25 22:42:41

How to remove slash at the end of one page with htaccess redirect?

There is a main page of the site - site.com. It is necessary that when the user enters "site.com/", a redirect to the "site.com" page occurs. It is important that this works only for one main page, and not for all pages of the site. And you need to do it through htaccess.
I googled but didn't understand anything. There only about how to remove slashes from all pages. I can’t deal with all these RewriteRule and RewriteCond, and I don’t know regular expressions at all. There is no need to study all this. You just need to solve this particular problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Skibin, 2017-09-26
@megafax

Did the SEO specialists tell you this? It won't work that way, because the main one - it's "/" is always requested this way. Here's how to remove the "/" in an HTTP request "GET /" ?

V
Viktor Taran, 2017-09-28
@shambler81

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question