NEW YOURLS-PV Install

with 1 Comment

Create and Load the YOURLS Directory

Make a directory under the document root called /yourls/.  Load the files from the YOURLS-PV package in the /yourls/ directory.

You may rename this /yourls/ directory to anything you like.  However, you must also make this change in the server configuration files like .htaccess.

For this example, we will use the domain names example.com, example.net and example.org, replace this as needed.

 

The YOURLS Config File

Make a Config File Name

The name of your config file will be your domain name plus “-config.php

Your domain name is what is between the double slash and the next following single slash. Some examples are:

  • http://example.com/ => example.com
  • http://example.net/s/aBc => example.net
  • http://example.org => example.org

The config file names for the above would be:

  • example.com-config.php
  • example.net-config.php
  • example.org-config.php

Three real-world domains I am planning to use in my Filipino Health project are:

  • https://vekind.org/ => vekind.org
  • https://tait.asia/ => tait.asia
  • https://fyuel.org/ => fyuel.org

Therefore the real-world config file names will be:

  • vekind.org-config.php
  • tait.asia-config.php
  • fyuel.org-config.php

If you need help in making this file name just point your browser to the physical file location and it should tell you it cannot find the file. Something like:

  • http://example.com/yourls/none
  • example.com => your domain name
  • yourls => your directory name
  • none => an otherwise valid YOURLS path (no ending slash).

 

Making the Site Configuration File

Now we have our site configuration file name, for example, example.org-config.php

In the /user/ directory, copy the file config-sample.php and name it your file name example.org-config.php (changing example.org to your domain name).

Now edit the file with your site-specific information.  This is identical to the standard YOURLS config file procedure, with one exception:

When you reach the line that says:

define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );

Just make it into a comment, like this:

// define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );

In YOURLS-PV YOURLS_SITE is only defined in the config file for sub-directory sites and sites where the Admin Server runs in HTTPS but the Redirect Server runs in HTTP.

 

Load the Database

This part is easy if the config file is configured correctly.  Simply just point your browser to the physical file location.

Something like:

  • http://example.com/yourls/none
  • example.com => your domain name
  • yourls => your directory name
  • none => an otherwise valid YOURLS path (no ending slash).

 

The .htaccess File

The above procedure will create an .htaccess file in the /yourls/ directory, that looks something like this:

# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /yourls/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls/yourls-loader.php [L]
</IfModule>
# END YOURLS

We will move this .htaccess file to the root directory and edit it to read:

# BEGIN YOURLS
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule . yourls/yourls-loader.php [L]
# END YOURLS

This follows the current methods used in WordPress Multisite Domain with Pretty Permalinks.

 

Adding More YOURLS Sites

Adding More YOURLS Sites is now a simple matter of two steps.

  1. Repeat The YOURLS Config File section above, using the new additional site’s information.
  2. Delete the .htaccess file created in the /yourls/ directory.

 

Corrections

Did you try this guide and it didn’t work?  Please let us know in the comments, so that we may improve the guide.

Did you find a better or faster way to do this?  Please let us know in the comments, so that we may pass it on to others.

 

Thank You Very Much!

One Response

  1. Configuration - YOURLS-PV
    | Reply

    […] NEW YOURLS-PV Install […]

Leave a Reply