{"action":"opened","number":198,"pull_request":{"url":"https://api.github.com/repos/mikecao/flight/pulls/198","id":40295279,"html_url":"https://github.com/mikecao/flight/pull/198","diff_url":"https://github.com/mikecao/flight/pull/198.diff","patch_url":"https://github.com/mikecao/flight/pull/198.patch","issue_url":"https://api.github.com/repos/mikecao/flight/issues/198","number":198,"state":"open","locked":false,"title":"Update Request.php to make flightphp working even if your documentroot is a subfolder","user":{"login":"s4wny","id":1197315,"avatar_url":"https://avatars.githubusercontent.com/u/1197315?v=3","gravatar_id":"","url":"https://api.github.com/users/s4wny","html_url":"https://github.com/s4wny","followers_url":"https://api.github.com/users/s4wny/followers","following_url":"https://api.github.com/users/s4wny/following{/other_user}","gists_url":"https://api.github.com/users/s4wny/gists{/gist_id}","starred_url":"https://api.github.com/users/s4wny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s4wny/subscriptions","organizations_url":"https://api.github.com/users/s4wny/orgs","repos_url":"https://api.github.com/users/s4wny/repos","events_url":"https://api.github.com/users/s4wny/events{/privacy}","received_events_url":"https://api.github.com/users/s4wny/received_events","type":"User","site_admin":false},"body":"# Case\r\n\r\nI want to set the root directory to the subdirectory `/public` so users can't access config files etc. This didn't work for me with the current FlightPHP code, so I made a path to make it work for my case. I think this change won't break old code but I'm not sure. I'm pusing it anyway so it show up on google for everyone who have this problem.\r\n\r\n## My setup\r\n```\r\n./my-project\r\n    /public\r\n        /css\r\n        /js\r\n        .htaccess         [1]\r\n        app.php           // FlightPHP app is here\r\n        ...\r\n    /vendor\r\n    /config\r\n    .htaccess             [2]\r\n    ...\r\n```\r\n\r\n.htaccess [1]\r\n```\r\nRewriteEngine On\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^(.*)$ app.php?/$1 [L]\r\n```\r\n\r\n.htacces [2]\r\n```\r\nRewriteEngine On\r\n\r\nRewriteCond %{REQUEST_URI} !public/.*$\r\nRewriteRule ^(.*)$ public/$1 [L]\r\n```\r\n\r\nSo when a user go to `http://website.com/my-project/` apache will actually load `http://website.com/my-project/public` which will load `http://website.com/my-project/app.php`.\r\n\r\n`http://website.com/my-project/admin/action/xd` apache will actually load `http://website.com/my-project/public` which will load `http://website.com/my-project/app.php/admin/action/xd`.\r\n\r\n`QUERY_STRING` = `/admin/action/xd/`.\r\n\r\n\r\nNote that you still need to set `Flight::set('flight.base_url', '/my-project/');` to make redirects work.","created_at":"2015-07-18T17:13:37Z","updated_at":"2015-07-18T17:13:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mikecao/flight/pulls/198/commits","review_comments_url":"https://api.github.com/repos/mikecao/flight/pulls/198/comments","review_comment_url":"https://api.github.com/repos/mikecao/flight/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mikecao/flight/issues/198/comments","statuses_url":"https://api.github.com/repos/mikecao/flight/statuses/b190bc2368fd50b98082a60f134d0a498fb9ed0a","head":{"label":"s4wny:bug/baseUrlDoesntWork","ref":"bug/baseUrlDoesntWork","sha":"b190bc2368fd50b98082a60f134d0a498fb9ed0a","user":{"login":"s4wny","id":1197315,"avatar_url":"https://avatars.githubusercontent.com/u/1197315?v=3","gravatar_id":"","url":"https://api.github.com/users/s4wny","html_url":"https://github.com/s4wny","followers_url":"https://api.github.com/users/s4wny/followers","following_url":"https://api.github.com/users/s4wny/following{/other_user}","gists_url":"https://api.github.com/users/s4wny/gists{/gist_id}","starred_url":"https://api.github.com/users/s4wny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s4wny/subscriptions","organizations_url":"https://api.github.com/users/s4wny/orgs","repos_url":"https://api.github.com/users/s4wny/repos","events_url":"https://api.github.com/users/s4wny/events{/privacy}","received_events_url":"https://api.github.com/users/s4wny/received_events","type":"User","site_admin":false},"repo":{"id":39277746,"name":"flight","full_name":"s4wny/flight","owner":{"login":"s4wny","id":1197315,"avatar_url":"https://avatars.githubusercontent.com/u/1197315?v=3","gravatar_id":"","url":"https://api.github.com/users/s4wny","html_url":"https://github.com/s4wny","followers_url":"https://api.github.com/users/s4wny/followers","following_url":"https://api.github.com/users/s4wny/following{/other_user}","gists_url":"https://api.github.com/users/s4wny/gists{/gist_id}","starred_url":"https://api.github.com/users/s4wny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s4wny/subscriptions","organizations_url":"https://api.github.com/users/s4wny/orgs","repos_url":"https://api.github.com/users/s4wny/repos","events_url":"https://api.github.com/users/s4wny/events{/privacy}","received_events_url":"https://api.github.com/users/s4wny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/s4wny/flight","description":"An extensible micro-framework for PHP","fork":true,"url":"https://api.github.com/repos/s4wny/flight","forks_url":"https://api.github.com/repos/s4wny/flight/forks","keys_url":"https://api.github.com/repos/s4wny/flight/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s4wny/flight/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s4wny/flight/teams","hooks_url":"https://api.github.com/repos/s4wny/flight/hooks","issue_events_url":"https://api.github.com/repos/s4wny/flight/issues/events{/number}","events_url":"https://api.github.com/repos/s4wny/flight/events","assignees_url":"https://api.github.com/repos/s4wny/flight/assignees{/user}","branches_url":"https://api.github.com/repos/s4wny/flight/branches{/branch}","tags_url":"https://api.github.com/repos/s4wny/flight/tags","blobs_url":"https://api.github.com/repos/s4wny/flight/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s4wny/flight/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s4wny/flight/git/refs{/sha}","trees_url":"https://api.github.com/repos/s4wny/flight/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s4wny/flight/statuses/{sha}","languages_url":"https://api.github.com/repos/s4wny/flight/languages","stargazers_url":"https://api.github.com/repos/s4wny/flight/stargazers","contributors_url":"https://api.github.com/repos/s4wny/flight/contributors","subscribers_url":"https://api.github.com/repos/s4wny/flight/subscribers","subscription_url":"https://api.github.com/repos/s4wny/flight/subscription","commits_url":"https://api.github.com/repos/s4wny/flight/commits{/sha}","git_commits_url":"https://api.github.com/repos/s4wny/flight/git/commits{/sha}","comments_url":"https://api.github.com/repos/s4wny/flight/comments{/number}","issue_comment_url":"https://api.github.com/repos/s4wny/flight/issues/comments{/number}","contents_url":"https://api.github.com/repos/s4wny/flight/contents/{+path}","compare_url":"https://api.github.com/repos/s4wny/flight/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s4wny/flight/merges","archive_url":"https://api.github.com/repos/s4wny/flight/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s4wny/flight/downloads","issues_url":"https://api.github.com/repos/s4wny/flight/issues{/number}","pulls_url":"https://api.github.com/repos/s4wny/flight/pulls{/number}","milestones_url":"https://api.github.com/repos/s4wny/flight/milestones{/number}","notifications_url":"https://api.github.com/repos/s4wny/flight/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s4wny/flight/labels{/name}","releases_url":"https://api.github.com/repos/s4wny/flight/releases{/id}","created_at":"2015-07-17T22:21:45Z","updated_at":"2015-07-17T22:21:46Z","pushed_at":"2015-07-18T17:13:03Z","git_url":"git://github.com/s4wny/flight.git","ssh_url":"git@github.com:s4wny/flight.git","clone_url":"https://github.com/s4wny/flight.git","svn_url":"https://github.com/s4wny/flight","homepage":"http://flightphp.com","size":354,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mikecao:master","ref":"master","sha":"4bb1b49385af656c1246f51db236e834b827aef6","user":{"login":"mikecao","id":477975,"avatar_url":"https://avatars.githubusercontent.com/u/477975?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecao","html_url":"https://github.com/mikecao","followers_url":"https://api.github.com/users/mikecao/followers","following_url":"https://api.github.com/users/mikecao/following{/other_user}","gists_url":"https://api.github.com/users/mikecao/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecao/subscriptions","organizations_url":"https://api.github.com/users/mikecao/orgs","repos_url":"https://api.github.com/users/mikecao/repos","events_url":"https://api.github.com/users/mikecao/events{/privacy}","received_events_url":"https://api.github.com/users/mikecao/received_events","type":"User","site_admin":false},"repo":{"id":1549947,"name":"flight","full_name":"mikecao/flight","owner":{"login":"mikecao","id":477975,"avatar_url":"https://avatars.githubusercontent.com/u/477975?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecao","html_url":"https://github.com/mikecao","followers_url":"https://api.github.com/users/mikecao/followers","following_url":"https://api.github.com/users/mikecao/following{/other_user}","gists_url":"https://api.github.com/users/mikecao/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecao/subscriptions","organizations_url":"https://api.github.com/users/mikecao/orgs","repos_url":"https://api.github.com/users/mikecao/repos","events_url":"https://api.github.com/users/mikecao/events{/privacy}","received_events_url":"https://api.github.com/users/mikecao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikecao/flight","description":"An extensible micro-framework for PHP","fork":false,"url":"https://api.github.com/repos/mikecao/flight","forks_url":"https://api.github.com/repos/mikecao/flight/forks","keys_url":"https://api.github.com/repos/mikecao/flight/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikecao/flight/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikecao/flight/teams","hooks_url":"https://api.github.com/repos/mikecao/flight/hooks","issue_events_url":"https://api.github.com/repos/mikecao/flight/issues/events{/number}","events_url":"https://api.github.com/repos/mikecao/flight/events","assignees_url":"https://api.github.com/repos/mikecao/flight/assignees{/user}","branches_url":"https://api.github.com/repos/mikecao/flight/branches{/branch}","tags_url":"https://api.github.com/repos/mikecao/flight/tags","blobs_url":"https://api.github.com/repos/mikecao/flight/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikecao/flight/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikecao/flight/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikecao/flight/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikecao/flight/statuses/{sha}","languages_url":"https://api.github.com/repos/mikecao/flight/languages","stargazers_url":"https://api.github.com/repos/mikecao/flight/stargazers","contributors_url":"https://api.github.com/repos/mikecao/flight/contributors","subscribers_url":"https://api.github.com/repos/mikecao/flight/subscribers","subscription_url":"https://api.github.com/repos/mikecao/flight/subscription","commits_url":"https://api.github.com/repos/mikecao/flight/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikecao/flight/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikecao/flight/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikecao/flight/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikecao/flight/contents/{+path}","compare_url":"https://api.github.com/repos/mikecao/flight/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikecao/flight/merges","archive_url":"https://api.github.com/repos/mikecao/flight/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikecao/flight/downloads","issues_url":"https://api.github.com/repos/mikecao/flight/issues{/number}","pulls_url":"https://api.github.com/repos/mikecao/flight/pulls{/number}","milestones_url":"https://api.github.com/repos/mikecao/flight/milestones{/number}","notifications_url":"https://api.github.com/repos/mikecao/flight/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikecao/flight/labels{/name}","releases_url":"https://api.github.com/repos/mikecao/flight/releases{/id}","created_at":"2011-03-31T07:48:42Z","updated_at":"2015-07-16T14:04:19Z","pushed_at":"2015-07-17T23:03:26Z","git_url":"git://github.com/mikecao/flight.git","ssh_url":"git@github.com:mikecao/flight.git","clone_url":"https://github.com/mikecao/flight.git","svn_url":"https://github.com/mikecao/flight","homepage":"http://flightphp.com","size":1271,"stargazers_count":1106,"watchers_count":1106,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":184,"mirror_url":null,"open_issues_count":15,"forks":184,"open_issues":15,"watchers":1106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mikecao/flight/pulls/198"},"html":{"href":"https://github.com/mikecao/flight/pull/198"},"issue":{"href":"https://api.github.com/repos/mikecao/flight/issues/198"},"comments":{"href":"https://api.github.com/repos/mikecao/flight/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/mikecao/flight/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/mikecao/flight/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mikecao/flight/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/mikecao/flight/statuses/b190bc2368fd50b98082a60f134d0a498fb9ed0a"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":1,"deletions":3,"changed_files":1}}