https://github.com/joshp23/YOURLS-Update-30X
Utility to check for endpoint URL redirections and update the long URL in YOURLS
https://github.com/joshp23/YOURLS-Update-30X
Last synced: about 1 year ago
JSON representation
Utility to check for endpoint URL redirections and update the long URL in YOURLS
- Host: GitHub
- URL: https://github.com/joshp23/YOURLS-Update-30X
- Owner: joshp23
- License: gpl-3.0
- Created: 2018-09-15T16:28:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-14T06:20:28.000Z (over 5 years ago)
- Last Synced: 2024-11-02T09:33:45.825Z (over 1 year ago)
- Language: PHP
- Size: 18.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - Update 30X - An API plugin to test single, domain based, or all available links and update the URL in YOURLS if redirection occures at the destination. (Plugins / U)
README
# YOURLS-Update-30X
Utility to check for endpoint URL redirections and update the long URL in YOURLS
## Features
- Can work on individual keywords, domain based long url's, or the entire database
- Returns number of attempts, successes, failures, and an array of unreachable links
- Indexes the YOURLS_url table when enabled
- API based to avoid PHP script execution limitation (This can be time consuming)
### Installation
- Copy the `update30X` folder into `YOURLS/user/plugins/`
- Enable in admin area.
### API
- `action=u30X`
If sent alone, this will check the entire table.
- `keyword=KEYWORD`
Use this to check a single record. Good for testing purposes.
- `domain=EXAMPLE.COM`
Use this to restrict the check to a single domain.
### Example Use Case:
This plugin was written to manage multiple URL redirects resulting from a Drupal to Wordpress migration.
- Convert your data to Wordpress and make use of either the recommended [Redirection](https://wordpress.org/plugins/redirection/) or [Simple 301 Redirects](https://wordpress.org/plugins/simple-301-redirects/) plugin.
- Retreive redirect data from the Wordpress database and RegEx the daylights out of that dataset so that redirects can be set up in `.htaccess` with something like the following:
```
RewriteCond %{QUERY_STRING} ^(q=node/1234)$
RewriteRule ^(.*)$ https://example.com/?p=23 [R=301,L]
RewriteRule ^/?node/1234w/? https://example.com/?p=23 [R=301,L]
```
- Once the redirects are set up, merely run a command like the following:
```
$ curl --data "format=json&signature=0YOUR0API0KEY&action=u301&domain=example.com" https://sho.rt/yourls-api.php | python -m json.tool
```
### Note:
With a YOURLS URL database of roughly 450 links, this process took roughly 3 minutes. Appx. 10 seconds was shaved off of this time with the table index. Please verify that it has been created before attempting large checks.
### Tips
Dogecoin: DARhgg9q3HAWYZuN95DKnFonADrSWUimy3