htaccessでお試しください
ドメインを持つWebサーバーの場合
RewriteEngine on
RewriteCond %{REQUEST_URI} ^https://www.example.com/(.*)$
RewriteRule %{REQUEST_URI} https://www.example.com/$1 [S=1,L]
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} [A-Z]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
ローカルサーバー用
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_URI} ^https://localhost/(.*)$
RewriteRule %{REQUEST_URI} https://localhost/$1 [S=1,L]
RewriteCond %{HTTP_HOST} ^localhost [NC,OR]
RewriteCond %{HTTP_HOST} [A-Z]
RewriteRule ^(.*)$ https://localhost/kernel/$1 [R=301,L]