I am working on a project in which i have migrated old to new site. SEO is still working for old site so i have written rules in my yii2 application as
'rules' => [
"<year:\d{4}>/<number1:\d{2}>/<number2:\d{2}>/<slug>"=>'video/parse',
This yii2 redirection is working fine for URLS not ending in trailing slash. But this rule fails for trailing slash URLs. To cope with this problem I tried to redirect through apache. To do so i write this code
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{SERVER_NAME} =mydomain.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
Problem1:
When I hit http://example.org/2017/09/10/slug/ then it is redirected to http://example.org//2017/09/10/slug/ as you can see an additional slash is added after domain name.
Problem2:
When I hit https://example.org/2017/09/10/slug/ then it is not redirected anyway.
Questions:
1. How do we redirect for trailing slash?
2. How to get the redirection working for https?