Comments (3)
Can you tell me a little more about your setup? How are you folders arranged and what is in your .htaccess file?
from core.
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.
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)
- Compatibility issue with PHP 8.1-8.2 HOT 7
- Route preg_match() error HOT 1
- display_errors does not work with flight HOT 4
- route view rendered after redirect HOT 7
- Argument #1 ($ex) must be of type Exception, TypeError given HOT 2
- Cors in Framework HOT 5
- describing routes HOT 3
- Slashes In Routes HOT 2
- Website outdated version HOT 1
- I make a new framework βAlightβ, can anyone try it and give me some feedback? HOT 1
- Flushing buffer results in Response->write() error HOT 1
- Migrate to Flight 2 HOT 1
- Future of the Flight Micro Framework HOT 19
- Naming routes - help for navigation HOT 4
- Example projects - What would that look like ? HOT 14
- Possible integration with Roadrunner and Swoole. HOT 2
- Possible way to generate OpenAPI specification on the fly. HOT 1
- Possible deployment on AWS Lambda. HOT 1
- Possible way to include some shorthand helpers or utils. HOT 12
- Documentation on how to Docker-ize FlightPHP application. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.