Skip to content

Redirects for non-existant short urls goes to full YOURLS directory #3584

Answered by dgw
adamesq asked this question in Q&A
Discussion options

You must be logged in to vote

What you describe is YOURLS' default behavior when a keyword isn't defined yet:

YOURLS/yourls-go.php

Lines 19 to 27 in f1ae0ef

// if we can get a long URL from the DB, redirect
if( $url = yourls_get_keyword_longurl( $keyword ) ) {
yourls_redirect_shorturl($url, $keyword);
return;
}
// Either reserved keyword, or no such keyword
yourls_do_action( 'redirect_keyword_not_found', $keyword );
yourls_redirect( YOURLS_SITE, 302 ); // no 404 to tell browser this might change, and also to not pollute logs

…likely combined with a webserver that is configured to show a directory listing when there's no index file (index.html, index.php, etc.),…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adamesq
Comment options

Answer selected by adamesq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants