Giter Site home page Giter Site logo

Comments (3)

mikecao avatar mikecao commented on May 22, 2024

Can you tell me a little more about your setup? How are you folders arranged and what is in your .htaccess file?

from core.

thybag avatar thybag commented on May 22, 2024

Hello,

The .htaccess file itself is pretty much the default, the only change being that its rewriting the URL to be a folder up from its normal location.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [QSA,L]

The issue then comes about as the $_SERVER['REQUEST_URI'] is unaware of the extra folders existence, meaning it sees the path as "/website/my/file/path" rather than the "/website/public/my/file/path". $_SERVER['SCRIPT_NAMEI'] on the other hand still pulls back the "real" path which includes the public folder.

The end result is that since the basename found isn't part of the url Flight is seeing, flight ends up trying to route on "/website/my/file/path" rather than "/my/file/path" which results in it 404ing.

I guessed that the best way to get around the issue would be to manually set the basename, although since the Request object appears to be created when flight starts, it turned out i also had to update the Request url parameter to reflect the basename change (as in the code in my first post).

My work around appears to work correctly so far, although still feels a little hacky. I wanted to double check there wasn't a proper way to achieve the same kind of result which i may have missed etc.

Thanks,.
thybag

from core.

mikecao avatar mikecao commented on May 22, 2024

I think you're handling it correctly given the situation. I'll see if I can find a solution for setting the basename through the framework, possibly as a config.

You may also want to look into the RewriteBase directive and see if that helps.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.