Here’s how to install YOURLS and WordPress both are in the same directory.

  1. Install WordPress
    1. https://www.bluehost.com/help/article/install-wordpress-manually
  2. Install YOURLS in the same directory with WordPress
    1. https://yourls.org/docs/guide/install
  3. Modify the .htaccess , see below
# BEGIN YOURLS and/or WordPress
RewriteEngine On
RewriteBase /

# Run index.php in the DocumentRoot
RewriteRule ^index\.php$ - [L]

# Add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

# Run any Physical File or Directory
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Run YOURLS
RewriteRule ^([0-9a-zA-Z-]+)\+?$  yourls-loader.php [L]

# Run WordPress (or index.php)
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END YOURLS and/or WordPress
[/php]

Source https://github.com/YOURLS/YOURLS/issues/2449