Pesquisar este blog

sábado, 6 de maio de 2017

Encurtador de URL próprio com nomes livres

Ter um encurtador de url próprio e bem útil porque te da a vantagem de ter todos os nomes que você desejar livres para que ele seja mais agradável aconselhamos que use um registro gratuito ou pago do menor tamanho possível para fácil memorização.
Neste caso estarei usando os serviços gratuitos da www.hostinger.com.br que são ótimos sem propagandas e procura sempre esta melhorando e se adaptando as necessidades de seus clientes através de feedbacks de avaliação de seus usuários e esta sempre evoluindo para um serviço de qualidade.
Ha www.hostinger.com.br também oferta excelentes serviços pagos e com valores bem agradáveis.

Bem então vamos colocar a mão na massa e começar a criar o nosso encurtador de urls
Itens necessários: 
Script Yourls 1.7.2 - https://yourls.org
Domínio Gratuito ou Pago
Bloco de notas do Windows ou Notepad++ 

Acesse seu painel de controle da Hostinger e encontre a opção Banco de Dados e clique em Bases de Dados MySQL 

Preencha os espaços
Nome do Banco de dados MySQL
Nome de usuário MySQL
Senha (Crie uma senha forte) 
Clique em Criar. 

Em meu caso ficou desta maneira 
Agora cesse o site https://yourls.org faça o download de Script Yourls 1.7.2 
O link para download do Script esta no final da pagina oficial que direcionara para outra pagina.

Bem apos realizado o download extraia todo o conteúdo em uma pasta em meu caso vou usar a pasta de nome #genericodigittal eles ficaram desta maneira...
Agora vamos alterar alguns arquivos.
Entre na pasta user
Renomeie o arquivo config-sample.php para config.php agora abra ele como o bloco de notas ou Notepad++

Altere os dados de acordo com seu banco de dados em meu caso ficou desta maneira destacado em VERMELHO Os destaquem em AZUL são opções não ligadas ao seu bando de dados -3 e o fuso horario do Brasil e username (Digite um login) e username2 (Digite uma Senha) 
O trecho em ROSA devera ser apagado para evitar que seu o Script Yourls 1.7.2 seja acessado por usuários não autorizados. 

/** MySQL database username */
define( 'YOURLS_DB_USER', 'u835547928_admin' );

/** MySQL database password */
define( 'YOURLS_DB_PASS', 'SENHA DO SEU BANCO DE DADOS' );

/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', 'u835547928_admin' );

/** MySQL hostname.
 ** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
define( 'YOURLS_DB_HOST', 'mysql.hostinger.com.br' );

/** MySQL tables prefix */
define( 'YOURLS_DB_PREFIX', 'yourls_' );

/*
 ** Site options
 */

/** YOURLS installation URL -- all lowercase and with no trailing slash.
 ** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
define( 'YOURLS_SITE', 'http://vips.16mb.com' );

/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', -3 ); 

/** YOURLS language
 ** Change this setting to use a translation file for your language, instead of the default English.
 ** That translation file (a .mo file) must be installed in the user/language directory.
 ** See http://yourls.org/translations for more information */
define( 'YOURLS_LANG', '' ); 

/** Allow multiple short URLs for a same long URL
 ** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
 ** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
define( 'YOURLS_UNIQUE_URLS', true );

/** Private means the Admin area will be protected with login/pass as defined below.
 ** Set to false for public usage (eg on a restricted intranet or for test setups)
 ** Read http://yourls.org/privatepublic for more details if you're unsure */
define( 'YOURLS_PRIVATE', true );

/** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );

/** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
 ** YOURLS will auto encrypt plain text passwords in this file
 ** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = array(
'username' => 'password',
// 'username2' => 'password2',
// You can have one or more 'login'=>'password' lines
);

/** Debug mode to output some internal information
 ** Default is false for live site. Enable when coding or before submitting a new issue */
define( 'YOURLS_DEBUG', false );
/*
 ** URL Shortening settings
 */

/** URL shortening method: 36 or 62 */
define( 'YOURLS_URL_CONVERT', 36 );
/*
 * 36: generates all lowercase keywords (ie: 13jkm)
 * 62: generates mixed case keywords (ie: 13jKm or 13JKm)
 * Stick to one setting. It's best not to change after you've started creating links.
 */

/** 
* Reserved keywords (so that generated URLs won't match them)
* Define here negative, unwanted or potentially misleading keywords.
*/
$yourls_reserved_URL = array(
'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick',
);

/*
 ** Personal settings would go after here.
 */

Feitas Todas as alterações salve, em meu caso o código ficou desta maneira: 

<?php
/* This is a sample config file.
 * Edit this file with your own settings and save it as "config.php"
 *
 * IMPORTANT: edit and save this file as plain ASCII text, using a text editor, for instance TextEdit on Mac OS or
 * Notepad on Windows. Make sure there is no character before the opening <?php at the beginning of this file.
 */

/*
 ** MySQL settings - You can get this info from your web host
 */

/** MySQL database username */
define( 'YOURLS_DB_USER', 'u835547928_admin' );

/** MySQL database password */
define( 'YOURLS_DB_PASS', 'admin1234' );

/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', 'u835547928_admin' );

/** MySQL hostname.
 ** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
define( 'YOURLS_DB_HOST', 'mysql.hostinger.com.br' );

/** MySQL tables prefix */
define( 'YOURLS_DB_PREFIX', 'yourls_' );

/*
 ** Site options
 */

/** YOURLS installation URL -- all lowercase and with no trailing slash.
 ** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
define( 'YOURLS_SITE', 'http://vips.16mb.com' );

/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', -3 ); 

/** YOURLS language
 ** Change this setting to use a translation file for your language, instead of the default English.
 ** That translation file (a .mo file) must be installed in the user/language directory.
 ** See http://yourls.org/translations for more information */
define( 'YOURLS_LANG', '' ); 

/** Allow multiple short URLs for a same long URL
 ** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
 ** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
define( 'YOURLS_UNIQUE_URLS', true );

/** Private means the Admin area will be protected with login/pass as defined below.
 ** Set to false for public usage (eg on a restricted intranet or for test setups)
 ** Read http://yourls.org/privatepublic for more details if you're unsure */
define( 'YOURLS_PRIVATE', true );

/** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );

/** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
 ** YOURLS will auto encrypt plain text passwords in this file
 ** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = array(
'Admin' => 'admin1234',
);

/** Debug mode to output some internal information
 ** Default is false for live site. Enable when coding or before submitting a new issue */
define( 'YOURLS_DEBUG', false );
/*
 ** URL Shortening settings
 */

/** URL shortening method: 36 or 62 */
define( 'YOURLS_URL_CONVERT', 36 );
/*
 * 36: generates all lowercase keywords (ie: 13jkm)
 * 62: generates mixed case keywords (ie: 13jKm or 13JKm)
 * Stick to one setting. It's best not to change after you've started creating links.
 */

/** 
* Reserved keywords (so that generated URLs won't match them)
* Define here negative, unwanted or potentially misleading keywords.
*/
$yourls_reserved_URL = array(
'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick',
);

/*
 ** Personal settings would go after here.
 */

Bem agora dentro da pasta onde esta todos os aquivos do Script crie uma pasta Zipada vazia de nome #genericodigittal, 
Agora pegue e arraste todos os arquivos para dentro dela
Vá agora ao seu painel de controle da www.hostinger.com.br e localize a opção Importar Web Site e clique nela.
Agora arraste a pasta #genericodigittal para dentro desta janela 

Quando o site da www.hostinger.com.br terminar de fazer o upload dos arquivos aparecera a mensagem File has been uploadded clique agora em Dashboard

Clique agora em seu endereço do site do lado esquerdo

Você sera direcionado para esta pagina

Na barra de endereço adicione /admin e pressione enter

Você sera direcionado para a pagina de instalação clique em Install YOURLS 

Tudo Ok clique em YOURLS Administration Page

Entre com o seu login e Senha e pressione Enter

Pronto você ja esta em seu painel de controle e so excluir os links encurtados que são instalados por padrão e começar a criar os seus próprios links encurtados.

Caso você deseje que esta pagina não apareça...

Você pode criar um arquivo index.html com o código abaixo e enviar para a raiz da instalação 
outra opção e crialo e enviar dentro da pasta zipada #genericodigittal.

<html>
<head>
<title> Nami </title>
<meta http-equiv="refresh" content="0; URL=LINK DE SEU SITE SEM / NO FINAL" />
</head>
<body>

</body>
</html>

Em meu caso ele ficou desta maneira
<html>
<head>
<title> Nami </title>
<meta http-equiv="refresh" content="0; URL=http://vips.16mb.com/admin/?action=logout" />
</head>
<body>

</body>
</html>

Assim toda vez que eu entro sou direcionado para a pagina de login mas você também pode usar o endereço de seu site, blog, youtube, facebook, twitter, etc...

Este tutorial foi criado com base na vídeo aula de Marcelo Consultor para este e outros videos dele acesse o canal dele https://www.youtube.com/user/ConsultorWebShop1

Vídeo de base para este tutorial


#genericodigittal #maceloconsultor #youlrs #passoapasso #tutorial #genericodigital

Nenhum comentário:

Postar um comentário