P
P
Pavel2015-04-03 11:41:29
Apache HTTP Server
Pavel, 2015-04-03 11:41:29

If I add a slash to the end of the URL, then the server gives a 404 error, how to fix it?

There is a URL, for example, site.ru/catalog - everything is great, all links on the site lead without a slash at the end, but if you use all sorts of utm tags, there is a slash before the "?" sign, and when you open the link site.ru/catalog / - the generated CMS 404 error falls out.
How to add to .htaccess (or not in it?) so that the slash also works?
Will a simple redirect (in an ad with a slash, and we redirect to "without a slash") not have a bad effect on advertising campaigns?
What's in .htaccess now:

RewriteBase /
RewriteRule ^в_наличии$ index.php?route=product/special [L]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-04-03
@miraage

301 redirect, or cut the slash yourself in the PHP router.

Z
zooks, 2015-04-03
@zooks

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

Source: stackoverflow.com/questions/4167539/remove-trailin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question