N
N
Nikita Zelikov2022-01-21 11:55:04
Apache HTTP Server
Nikita Zelikov, 2022-01-21 11:55:04

How to configure .htaccess to return an address with a trailing slash?

I tried to redirect to a page with a slash, there were problems, I will attach the code below.
It turned out to achieve redirection, but there was a problem that all files are now taken relative to the base url ...
Maybe I set something crookedly?

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

#    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^(.+)/$
    RewriteRule ^(.+)/$ https://dev.wedbanket.ru/$1 [R=301,L]

//позволяет переадресовать с закрытым слешем /
#    RewriteCond %{REQUEST_FILENAME} !-f
#    RewriteCond %{REQUEST_URI} !\..{1,10}$
#    RewriteCond %{REQUEST_URI} !(.*)/$
#    RewriteRule ^(.*)$ https://dev.wedbanket.ru/$1/ [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

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