I
I
Ilya17912022-02-08 16:18:23
htaccess
Ilya1791, 2022-02-08 16:18:23

How to make one page without a slash on a site with a url with a slash?

There is a site where there is a 301 redirect to pages with a slash. There was a need to make one page so that it redirects to without a slash. (This is necessary for parsing by a third-party service, which we cannot influence, and it only works with a url without a slash).
I tried different options from the Internet. Now the following code is registered in .htaccess:

RewriteCond %{REQUEST_URI} !\?
  RewriteCond %{REQUEST_URI} !\&
  RewriteCond %{REQUEST_URI} !\=
  RewriteCond %{REQUEST_URI} !\.
  RewriteCond %{REQUEST_URI} !\/$
  RewriteCond %{REQUEST_FILENAME} /food/
  RewriteRule ^food/$ /food [R=301,L]


But doesn't work. The page without the slash returns a 403 Forbidden response.
How can this be implemented?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question