php - Slim Framework : Homepage Routing without Trailing Slash -


using slim 3, want homepage url www.domain.com instead of www.domain.com/.

this routing redirect home request www.domain.com/

$app->get('/', function ($request, $response, $args) {  }); 

but 1 gives me error.

$app->get('', function ($request, $response, $args) {  }); 

i'm using standard .htaccess :

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ index.php [qsa,l] 

i think common issue. best workaround this?

edit:

what trick or workaround homepage url looked without trailing slash on address bar?

the first / required http spec. if go https://stackoverflow.com in firefox , inspect headers sent using livehttpheaders, see this:

 / http/1.1 host: stackoverflow.com user-agent: mozilla/5.0 (macintosh; intel mac os x 10.11; rv:45.0) gecko/20100101 firefox/45.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-gb,en;q=0.5 accept-encoding: gzip, deflate dnt: 1 cookie: prov=6c390324-a9bb-439b-872e-ab428c1c136d; __cfduid=dd9fcf26e8242833656cda6fbe7719d851450684069; _ga=ga1.2.1110081223.1450684070 connection: keep-alive 

as can see request line (get / http/1.1), initial / automatically added browser specified in section 5.2.1 of rfc2616 says:

note absolute path cannot empty; if none present in original uri, must given "/" (the server root).


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -