Answer the question
In order to leave comments, you need to log in
How to remove / from the end of a link?
Hello!
How to make a redirect when going from site.com/news/ to site.com/news?
Live example: formulaz.ru/mrt-skani needs to
be redirected
to formulaz.ru/mrt-skani /../../news to site.com/news. example - formulaz.ru/sometext/mrt-skani - the page is displayed but I would also like to redirect to formulaz.ru/mrt-skani
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]
#php_value magic_quotes_gpc Off
Options +Includes +FollowSymLinks -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^search/$ index.php?module=search&mode=text&page=1 [L,QSA]
RewriteRule ^search/([0-9]+)/$ index.php?module=search&mode=text&page=$1 [L,QSA]
RewriteRule ^news$ index.php?module=news&page=news [L,QSA]
RewriteRule ^news/(.*)$ index.php?module=news&post=$1&page=news [L,QSA]
RewriteRule ^reviews$ index.php?module=ot&page=ot [L,QSA]
RewriteRule ^reviews/(.*)$ index.php?module=ot&post=$1&page=ot [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*) index.php?module=static_content&page=$1 [L,QSA]
</IfModule>
Answer the question
In order to leave comments, you need to log in
what is the difference between this site.com/news/ and this site.com/news slash ?
This command is run in htaccess and it removes the slash from the URL :
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question