Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szepeviktor/rootfiles
Important files in the document root which get downloaded without links.
https://github.com/szepeviktor/rootfiles
document-root download root website
Last synced: 29 days ago
JSON representation
Important files in the document root which get downloaded without links.
- Host: GitHub
- URL: https://github.com/szepeviktor/rootfiles
- Owner: szepeviktor
- License: mit
- Created: 2016-07-08T13:02:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T02:07:14.000Z (over 1 year ago)
- Last Synced: 2024-10-09T10:06:08.708Z (about 1 month ago)
- Topics: document-root, download, root, website
- Language: PHP
- Homepage:
- Size: 1.17 MB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: Security Policies/README.md
Awesome Lists containing this project
README
# Serve files missing from the document root
[![Build Status](https://app.travis-ci.com/szepeviktor/RootFiles.svg?branch=master)](https://app.travis-ci.com/szepeviktor/RootFiles)
Not all projects have the resources to hand-craft every *root file*.
This single PHP class generates all of them for you. Apache configuration files are also included.
This repository is modular. See **Adding a new root file** section below.
## Usage
```bash
# Clone this repo
git clone https://github.com/szepeviktor/RootFiles.git
cd RootFiles/bin/
# Generate Apache configuration files
./generate-apache-httpd-configs.sh /directory/for/generator-script
```Comment out aliases for **existing files** in `dist/rootfiles.conf`,
include it in your site's configuration
and copy `dist/rootfiles.php` at the specified path.You're done!
## Download
If you don't have access to Apache vhost config
just download the [current release](https://github.com/szepeviktor/RootFiles/releases/latest) (`.htaccess` and `rootfiles.php`)
and place them in your site's document root.## 404 handling
See https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/404-adaptive.php
Based on https://github.com/mathiasbynens/small
## See the results
Search access log for served root files
```bash
grep -E "GET ($(sed -ne 's|^\s*Alias "\(.\+\)" /.\+$|\1|p' rootfiles.conf|paste -d"|" -s) HTTP/)" /var/log/apache2/access.log
```## List of Well-Known URIs
http://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml
## Other root files
- If users are allowed to upload files to any directory use an upload warning file found in `/_File upload warning`
- Site verification files for Google, Bing, Yandex and Baidu
- PHP user configuration `.user.ini` http://php.net/manual/en/configuration.file.per-user.php
- Apache httpd directory configuration `.htaccess` (with rewrite rules, security, compression, browser cache etc. settings)## Alternative solution
```apache
RewriteEngine On
RewriteRule "^/apple-app-site-association$" - [R=200]# Inline response body
ErrorDocument 200 '{ "applinks": { "apps": [], "details": [] } }'```
## Contribution
[PR-s](https://github.com/szepeviktor/RootFiles/pulls) are welcome!
### Adding a new root file
1. Add a `README.md` file (example below)
1. Add all the paths with leading slash in `.path`
1. Create the file with minimal contents with full path (could be in a subdirectory)
1. Add `generator.phps` with case statement (path, content type, content) you may use the `%%FILE:file.ext%%` placeholder for base64 encoded file contents
1. Optionally add full example in the `_example` directory```markdown
# Full Name with Company and FunctionSmall description.
| Data | |
| ------------- | ------------- |
| file name | file.ext |
| type | JSON |
| specification | [Title](/URL) |
| tutorial | [Title](/URL) |### HTML head link
Or: Must be in the document root.
```