D
D
Darklt2021-08-01 15:47:16
htaccess
Darklt, 2021-08-01 15:47:16

Why doesn't httacces redirect work correctly in Yii2?

It is necessary that on the main index.php be transferred to the main domain and pages with a slash are redirected without a slash. Here is my
htaccess:

RewriteEngine on
Options +FollowSymLinks
RewriteBase /
RewriteRule . index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP
RewriteRule ^index\.php$ https://site.ru/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]


But a redirect with a slash redirects, for example, from the page
/site/page/1
to
/index.php/page/1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-08-01
@dodo512

RewriteRule . index.php

This rule needs to be moved down so that it is the last rule to be executed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question