1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3510],{4931(e,s,n){n.r(s),n.d(s,{assets:()=>t,contentTitle:()=>d,default:()=>h,frontMatter:()=>l,metadata:()=>i,toc:()=>a});const i=JSON.parse('{"id":"guide/essentials/configuration","title":"Configuration","description":"This page details how you are supposed to edit your user/config.php (with a raw text editor such as Notepad)","source":"@site/docs/guide/essentials/configuration.md","sourceDirName":"guide/essentials","slug":"/guide/essentials/configuration","permalink":"/docs/guide/essentials/configuration","draft":false,"unlisted":false,"editUrl":"https://github.com/YOURLS/website/edit/main/docs/guide/essentials/configuration.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docs","previous":{"title":"Essentials","permalink":"/docs/category/essentials"},"next":{"title":"Credentials","permalink":"/docs/guide/essentials/credentials"}}');var r=n(4848),o=n(8453);const l={},d="Configuration",t={},a=[{value:"MySQL settings",id:"mysql-settings",level:2},{value:"<code>YOURLS_DB_USER</code>",id:"yourls_db_user",level:3},{value:"<code>YOURLS_DB_PASS</code>",id:"yourls_db_pass",level:3},{value:"<code>YOURLS_DB_NAME</code>",id:"yourls_db_name",level:3},{value:"<code>YOURLS_DB_HOST</code>",id:"yourls_db_host",level:3},{value:"<code>YOURLS_DB_PREFIX</code>",id:"yourls_db_prefix",level:3},{value:"Site options",id:"site-options",level:2},{value:"<code>YOURLS_SITE</code>",id:"yourls_site",level:3},{value:"<code>YOURLS_PRIVATE</code>",id:"yourls_private",level:3},{value:"<code>YOURLS_UNIQUE_URLS</code>",id:"yourls_unique_urls",level:3},{value:"<code>YOURLS_COOKIEKEY</code>",id:"yourls_cookiekey",level:3},{value:"<code>$yourls_user_passwords</code>",id:"yourls_user_passwords",level:3},{value:"URL Shortening settings",id:"url-shortening-settings",level:2},{value:"<code>YOURLS_URL_CONVERT</code>",id:"yourls_url_convert",level:3},{value:"<code>$yourls_reserved_URL</code>",id:"yourls_reserved_url",level:3},{value:"Optional settings",id:"optional-settings",level:2},{value:"<code>YOURLS_PRIVATE_INFOS</code>",id:"yourls_private_infos",level:3},{value:"<code>YOURLS_PRIVATE_API</code>",id:"yourls_private_api",level:3},{value:"<code>YOURLS_NOSTATS</code>",id:"yourls_nostats",level:3},{value:"Protecting your config file",id:"protecting-your-config-file",level:2}];function c(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.header,{children:(0,r.jsx)(s.h1,{id:"configuration",children:"Configuration"})}),"\n",(0,r.jsxs)(s.p,{children:["This page details how you are supposed to edit your ",(0,r.jsx)(s.code,{children:"user/config.php"})," (with a raw text editor such as Notepad)"]}),"\n",(0,r.jsx)(s.h2,{id:"mysql-settings",children:"MySQL settings"}),"\n",(0,r.jsx)(s.h3,{id:"yourls_db_user",children:(0,r.jsx)(s.code,{children:"YOURLS_DB_USER"})}),"\n",(0,r.jsx)(s.p,{children:"MySQL username. Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_DB_USER', 'joe' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_db_pass",children:(0,r.jsx)(s.code,{children:"YOURLS_DB_PASS"})}),"\n",(0,r.jsx)(s.p,{children:"MySQL password. Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_DB_PASS', 'MySeCreTPaSsW0rd' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_db_name",children:(0,r.jsx)(s.code,{children:"YOURLS_DB_NAME"})}),"\n",(0,r.jsx)(s.p,{children:"The database name. Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_DB_NAME', 'yourls' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_db_host",children:(0,r.jsx)(s.code,{children:"YOURLS_DB_HOST"})}),"\n",(0,r.jsx)(s.p,{children:"Database host. Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_DB_HOST', 'localhost' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_db_prefix",children:(0,r.jsx)(s.code,{children:"YOURLS_DB_PREFIX"})}),"\n",(0,r.jsx)(s.p,{children:"The name prefix for all the tables YOURLS will need.Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_DB_PREFIX', 'yourls_' );\n"})}),"\n",(0,r.jsx)(s.h2,{id:"site-options",children:"Site options"}),"\n",(0,r.jsx)(s.h3,{id:"yourls_site",children:(0,r.jsx)(s.code,{children:"YOURLS_SITE"})}),"\n",(0,r.jsx)(s.p,{children:"Your (hopefully short) domain URL, no trailing slash, lowercase. If you pick the non-www version of your domain, don't use the www version in your browser (and vice-versa). Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_SITE', 'https://your-own-domain-here.com' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_private",children:(0,r.jsx)(s.code,{children:"YOURLS_PRIVATE"})}),"\n",(0,r.jsx)(s.p,{children:"Private means the admin area will be protected with login/pass as defined below."}),"\n",(0,r.jsxs)(s.p,{children:["See ",(0,r.jsx)(s.a,{href:"/docs/guide/essentials/private-or-public",children:"related page"}),"."]}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_PRIVATE', true );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_unique_urls",children:(0,r.jsx)(s.code,{children:"YOURLS_UNIQUE_URLS"})}),"\n",(0,r.jsxs)(s.p,{children:["Allow multiple short URLs for a same long URL.\nSet to true to allow only one pair of short URL / long URL (default YOURLS behavior), or to false to allow creation of multiple short URLs pointing to the same long URL (as ",(0,r.jsx)(s.code,{children:"bit.ly"})," does)"]}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_UNIQUE_URLS', true );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_cookiekey",children:(0,r.jsx)(s.code,{children:"YOURLS_COOKIEKEY"})}),"\n",(0,r.jsxs)(s.p,{children:["A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: generate a unique one at ",(0,r.jsx)(s.a,{href:"https://yourls.org/cookie",children:"yourls.org/cookie"})]}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define( 'YOURLS_COOKIEKEY', 'qQ4KhL_pu|s@Zm7n#%:b^{A[vhm' );\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_user_passwords",children:(0,r.jsx)(s.code,{children:"$yourls_user_passwords"})}),"\n",(0,r.jsxs)(s.p,{children:["A list of username(s) and password(s) allowed to access the site if private.\nPasswords can either be in plain text, or encrypted. See ",(0,r.jsx)(s.a,{href:"/docs/guide/essentials/credentials",children:"related page"}),"."]}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"$yourls_user_passwords = array(\n 'joe' => 'MyPassword',\n);\n"})}),"\n",(0,r.jsx)(s.h2,{id:"url-shortening-settings",children:"URL Shortening settings"}),"\n",(0,r.jsx)(s.h3,{id:"yourls_url_convert",children:(0,r.jsx)(s.code,{children:"YOURLS_URL_CONVERT"})}),"\n",(0,r.jsxs)(s.p,{children:["How short URLs will be generated. See ",(0,r.jsx)(s.a,{href:"/docs/guide/essentials/charset",children:"related page"}),". Example:"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define('YOURLS_URL_CONVERT', 36);\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_reserved_url",children:(0,r.jsx)(s.code,{children:"$yourls_reserved_URL"})}),"\n",(0,r.jsx)(s.p,{children:"A list of reserved keywords that won't be used as short URLs. Define here negative, unwanted or potentially misleading keywords"}),"\n",(0,r.jsx)(s.p,{children:"Example:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick'\n"})}),"\n",(0,r.jsx)(s.h2,{id:"optional-settings",children:"Optional settings"}),"\n",(0,r.jsx)(s.h3,{id:"yourls_private_infos",children:(0,r.jsx)(s.code,{children:"YOURLS_PRIVATE_INFOS"})}),"\n",(0,r.jsxs)(s.p,{children:["If YOURLS_PRIVATE is set to ",(0,r.jsx)(s.code,{children:"true"}),", you can still make stat pages public. Example:"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define('YOURLS_PRIVATE_INFOS', false);\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_private_api",children:(0,r.jsx)(s.code,{children:"YOURLS_PRIVATE_API"})}),"\n",(0,r.jsxs)(s.p,{children:["If YOURLS_PRIVATE is set to ",(0,r.jsx)(s.code,{children:"true"}),", you can still make your API public. Example:"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define('YOURLS_PRIVATE_API', false);\n"})}),"\n",(0,r.jsx)(s.h3,{id:"yourls_nostats",children:(0,r.jsx)(s.code,{children:"YOURLS_NOSTATS"})}),"\n",(0,r.jsxs)(s.p,{children:["If YOURLS_NOSTATS is set to ",(0,r.jsx)(s.code,{children:"true"}),", redirects won't be logged and there will be not stat available. Example:"]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-php",children:"define('YOURLS_NOSTATS', true);\n"})}),"\n",(0,r.jsx)(s.h2,{id:"protecting-your-config-file",children:"Protecting your config file"}),"\n",(0,r.jsxs)(s.p,{children:["A good practice, especially in a shared hosting environment, is to change file permissions to disallow write access to your files. The best thing to do is to edit your ",(0,r.jsx)(s.code,{children:"config.php"})," with a new password, run YOURLS to get it encrypted, and then remove write permissions."]}),"\n",(0,r.jsxs)(s.p,{children:["Depending on your host, you should change ",(0,r.jsx)(s.code,{children:"config.php"})," permissions to 400, 440 or 600. This can be done via the command-line (",(0,r.jsx)(s.code,{children:"chmod 0440 config.php"}),") or using your FTP client. For more help on this matter, please contact your host support."]}
1)]})}function h(e={}){const{wrapper:s}={...(0,o.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453(e,s,n){n.d(s,{R:()=>l,x:()=>d});var i=n(6540);const r={},o=i.createContext(r);function l(e){const s=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),i.createElement(o.Provider,{value:s},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.