slimphp/Slim-Skeleton

Root URL includes unnecessary slash when installed in subfolder, how to remove it?

yutakatsuchida opened this issue · 3 comments

Hello

I recently installed Slim-Skeleton to a subfolder on my domain, located at mydomain.com/skeleton. However, I have noticed that when I try to access this URL, it automatically redirects to mydomain.com/skeleton/ with a trailing slash at the end. This behavior is causing some issues for my project, and I would like to remove the slash from the end of the URL.

Can anyone provide guidance on how to remove the trailing slash from the root URL when Slim-Skeleton is installed in a subfolder? Any help would be greatly appreciated. Thank you!

Hello @eugene-borovov,

Thank you for the reference. I tested it but I got the following error on my browser.

This page isn’t workingtuma.jp redirected you too many times.
ERR_TOO_MANY_REDIRECTS

Is there something wrong with the following two .htaccess files?

/skeleton/.htaccess

RewriteEngine On
RewriteBase /skeleton
RewriteRule (.*) public/$1 [L]

/skeleton/public/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
  
RewriteBase /skeleton

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
</IfModule>

Hello @yutakatsuchida,

I have no ApacheServer about my hand. But I think this article should help you. The article describes your problem.