Please help me test the YOURLS-PV Patch in MultiSite mode.
The YOURLS-PV (Pretty Valuable) Patch is a simple, tiny patch to the magnificent YOURLS project. Although only a small patch, it is a possible solution to some known YOURLS problems and may provide workable code for some of the YOURLS most requested features.
- Fixes the trailing edge slash configuration error.
- Gives YOURLS its own directory.
- Allows YOURLS to work in MultiSite mode.
- WordPress and YOURLS can share the root directory.
- Allows the admin directory to be renamed.
- YOURLS_SITE automatically calculated.
I am running this tiny patch on my production servers without problems.
YOURLS ships with over 550 files. This tiny patch only makes small configuration changes (see below) on 5 of the programs files (plus a couple sample/example pages). The YOURLS-PV patch does not change the basic operation of the YOURLS program.
Get The Code:
Navigate to https://github.com/PopVeKind/YOURLS/tree/PV
This is Branch PV!
On the right, click on “Clone or download”
Then click Download ZIP.
What You Will Need:
To test the YOURLS-PV patch you will need an Apache Server and two domain names for testing.
Not to worry, if you owned the domain cu.te you could use it and b.cu.te. Or use the a.cu.te and b.cu.te subdomains! 🙂
Even these domains would work for testing the YOURLS-PV patch:
Basically, that is what I have.
If you are a nginx expert and have no problem converting .htaccess files to nginx server files, please share it!
I will make myself available for anyone wanting to try/test the YOURLS-PV patch.
Documentation is lagging behind development, but as I get it written I will post it on this website.
Activating Expanded Features:
Most of the “New Features” in the YOURLS-PV patch are simple changes in the config file that YOURLS users will be comfortable with. Depending on what features you want to add, you may need to copy/paste a small amount into the .htaccess file too.
About the YOURLS-PV Patch:
The main patch in YOURLS-PV is about the constant YOURLS_SITE. This constant is used in YOURLS for two main purposes.
The FIRST purpose for YOURLS_SITE is to add the domain while building the short URLs. For example:
Having both of these purposes on the same constant prevents YOURLS from having its own directory.
Likewise, making this one constant serve two purposes, largely prevents MultiSite operation (the main driving force of the YOURLS-PV patch).
In addition, the largest configuration error in installed YOURLS sites is the trailing slash in the constant YOURLS_SITE. The YOURLS-PV tiny patch totally prevents this error. Actually, in most cases, YOURLS_SITE can be removed from the config.php file as YOURLS-PV automatically calculates it!
The YOURLS-PV patch divides the YOURLS_SITE constant into two constants.
- YOURLS_SITE is tasked with the first purpose, to create short URLs.
- YOURLS_ABSURL is tasked with the second purpose, to provide an ABSolute URL to where the YOURLS files are.
- YOURLS_ABSURL is automatically calculated.
- YOURLS_SITE is usually automatically calculated but may be configured.
As you will notice, this does not change the basic workings of the YOURLS programming.
Fixes the YOURLS_SITE Trailing Slash Error:
It is reported the trailing slash error in YOURLS_SITE is a long-standing problem affecting 4% of all YOURLS sites.
The YOURLS-PV patch totally eliminates this error.
- 96% of installed YOURLS sites could install the YOURLS-PV patch, in the form of an update, and are 100% compatible with no configuration change at all!
- 4% of installed YOURLS sites, when the Admin upgraded and tested, would be advised to fix trailing slash errors in YOURLS_SITE. This could be done by either removing the YOURLS_SITE constant from the config file (allowing automatic configuration) OR removing the trailing slash in YOURLS_SITE.
Gives YOURLS Its Own Directory:
Having YOURLS in its own directory is a long time requested feature.
This idea is basically stolen from WordPress. ( See: Giving WordPress Its Own Directory ).
This is necessary for the YOURLS multiSite problem. For example, consider our two imaginary sites above, http://cu.te and http://ti.ny/s – in MultiSite mode, which directory should we put the YOURLS files?
- The “root” directory for http://cu.te
- The “s” directory for http://ti.ny/s
Allows YOURLS To Work in MultiSite Mode:
YOURLS MultiSite in is a long requested feature.
The tiny YOURLS-PV patch allows one instance (one set of files) to be configured with many domains, each acting independently of the others.
WordPress and YOURLS Together:
WordPress and YOURLS addressed together in the **root directory**, has been a long requested feature.
The following is now working:
YOURLS-PV (single site or MultiSite, in its own directory).
WordPress (single site, MultiSite-Domain, with or without the MultiNetwork Plugin).
WordPress may be configured with Pretty-Permalinks or the basic addressing (using query strings).
Allows The Admin Directory To Be Renamed:
Renaming the admin directory is a long requested feature.
The YOURLS-PV patch allows a simple and easy way to rename the admin directory.
YOURLS_SITE Automatically Calculated:
The most common configuration error in YOURLS is the YOURLS_SITE constant.
In Most Cases, the constant YOURLS_SITE, formerly defined in the config.php file, may be left undefined and the YOURLS-PV patch will automatically calculate it.
“Most Cases” we define as:
- YOURLS addressed in the root directory. ( http://cu.te/abc or https://cu.te/abc )
“Special Cases” we define as:
- YOURLS addressed in a subdirectory. ( http://ti.ny/s/abc or https://ti.ny/s/abc )
- YOURLS redirect server (HTTP) has a different protocol than the admin server (HTTPS).
Proof Of Concept Demo
The following links go to a Single Installation of YOURLS with the YOURLS-PV Patch. It is loaded into the /s/ directory and configured for MultiSite Mode. The admin directory was easily changed (renamed) to the hide directory.
Note: The default of any domain is any unused YOURLS keyword (examples /none, /fail, /empty, or /default). The autoloaded keywords are also active (/yourls and /ozh).
http://a.fil.net/s/54 => http://vekind.org/
http://a.fil.net/s/none => http://a.fil.net/s/ (the default page index.php)
http://a.fil.net/s/hide/index.php – The YOURLS admin page.
http://a.fil.net/s/ozh => http://ozh.org/
http://a.fil.net/s/yourls => http://yourls.org/
http://b.ph2.biz/54 => http://tukod.com/yourls-multisite/
http://b.ph2.biz/s/hide/index.php – YOURLS admin page.
http://b.ph2.biz/ozh => http://ozh.org/
http://b.ph2.biz/fail => http://b.ph2.biz/
http://c.c143.net/54 => http://tait.asia/2017/02/09/resources/
http://c.c143.net/yourls => http://yourls.org/
http://x.fil.net/54 => http://fyuel.org/
http://y.ph2.biz/s/54 => http://abolitionistapproach.info/
http://z.z143.net/54 => http://plant-only.org/plant-only-basics/
http://z.z143.net/A-A => http://abolitionistapproach.info/our-declaration-of-independence/
http://z.z143.net/a-a => http://abolitionistapproach.info/star-wars-rights-sentience/
Note: z.z143.net has the following activated:
- Allow hyphens in short URLs
- define( ‘YOURLS_URL_CONVERT’, 62 );