[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/ -> yourls-go.php (source)

   1  <?php
   2  define( 'YOURLS_GO', true );
   3  require_once( dirname( __FILE__ ) . '/includes/load-yourls.php' );
   4  
   5  // Variables should be defined in yourls-loader.php
   6  if( !isset( $keyword ) ) {
   7      yourls_do_action( 'redirect_no_keyword' );
   8      yourls_redirect( YOURLS_SITE, 301 );
   9  }
  10  
  11  $keyword = yourls_sanitize_keyword($keyword);
  12  
  13  // if we have a page, display and exit
  14  if( yourls_is_page($keyword) ) {
  15      yourls_page( $keyword );
  16      return;
  17  }
  18  
  19  // if we can get a long URL from the DB, redirect
  20  if( $url = yourls_get_keyword_longurl( $keyword ) ) {
  21      yourls_redirect_shorturl($url, $keyword);
  22      return;
  23  }
  24  
  25  // Either reserved keyword, or no such keyword
  26  yourls_do_action( 'redirect_keyword_not_found', $keyword );
  27  yourls_redirect( YOURLS_SITE, 302 ); // no 404 to tell browser this might change, and also to not pollute logs
  28  exit();


Generated: Mon Sep 16 05:10:05 2024 Cross-referenced by PHPXref 0.7.1