O
O
Orkhan Hasanli2018-06-10 13:59:55
Nginx
Orkhan Hasanli, 2018-06-10 13:59:55

How to set up a redirect?

Good day!
There are 2 VPs of the site installed on the hosting. The second site is installed in the directory and, accordingly, is available at example.com/wordpress (the VP is also installed at example.com).
The problem is the following - when accessing the page example.com/wordpress/ there is no redirect to the URL without a slash. Although, permalinks without a slash are configured by default in the VI.
When I try to set up a redirect through regexp, I get an error 500. I searched the net, but I can’t find a specific solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-06-10
@shambler81

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
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