Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/YOURLS/404-if-not-found
Redirect with a 404 when short URL is not found
https://github.com/YOURLS/404-if-not-found
404 yourls yourls-plugin
Last synced: 14 days ago
JSON representation
Redirect with a 404 when short URL is not found
- Host: GitHub
- URL: https://github.com/YOURLS/404-if-not-found
- Owner: YOURLS
- License: wtfpl
- Created: 2020-04-25T13:42:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-16T19:34:41.000Z (11 months ago)
- Last Synced: 2024-10-24T00:14:10.594Z (23 days ago)
- Topics: 404, yourls, yourls-plugin
- Language: PHP
- Size: 10.7 KB
- Stars: 23
- Watchers: 7
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - 404 If Not Found - Give a 404 Not Found if the short URL is not found. (Plugins / 0-9)
README
# YOURLS plugin : 404 if not found [![Listed in Awesome YOURLS!](https://img.shields.io/badge/Awesome-YOURLS-C5A3BE)](https://github.com/YOURLS/awesome-yourls/)
By default and by design, when a requested short URL is not found, YOURLS redirects to the site root with a "302 temporary redirect" header.
From the source:
```php
yourls_redirect( YOURLS_SITE, 302 ); // no 404 to tell browser this might change,
// and also to not pollute logs
```This plugin outputs a default "`404 not found`" error page instead.
## Installation
1. In `/user/plugins`, create a new folder named `404-if-not-found`.
2. Drop these files in that directory.
3. Go to the Plugins administration page (eg. `http://sho.rt/admin/plugins.php`) and activate the plugin.
4. Have fun!## License
Do whatever the hell you want with this.