Generador online de .htaccess
Generador online de .htaccess (htaccess online generator). Revisando los repositorios de Github, encontré un generador online de .htaccess que quiero compartir con los lectores de "Sololinux". Al ver el código, me sorprendió el buen diseño y trabajo que el amigo Emirodgar había realizado. El resultado final está muy elaborado, y cuenta con excelentes características, que pasamos a enumerar: Opciones de acceso Establece el dominio principal. Redireccionamiento a www. https redirect. Opciones de configuración Página de acceso predeterminada. Juego de caracteres predeterminado. Forzar la descarga de un tipo de archivo. Limitar el tamaño del archivo a subir. Configurar el correo del administrador. Actuación Activar la compresión Gzip. Habilitar los encabezados de Keep-Alive. Vencimiento de los encabezados (headers). Páginas de error personalizadas Error 404 Error 500 Opciones de seguridad Bloquear la navegación por el directorio. Deshabilitar la ejecución de CGI. Oculta la información sensible del servidor. Evitar que inserten tus páginas en otros sitios web. Deshabilita la firma del servidor. Bloquea los robots de SPAM más conocidos. Evita el acceso ilegal o inseguro. No permitir la ejecución de scripts (define las extensiones). Deniega los métodos de solicitud que definas. No permite el hotlinking. Antes de realizar cualquier modificación en tu archivo htaccess, te recomiendo que hagas una copia de seguridad. Es algo típico que por cualquier error en el archivo, el servidor lance un error 500.
Generador online de .htaccess
Como considero que es una utilidad altamente recomendable, la hemos subido a sololinux, para que puedas generar tu archivo htaccess, lo encontraras en la siguiente url. htaccess online generator Si prefieres tener tu propio generador online de .htaccess, es tan simple como crear un archivo html y copiar y pegar lo siguiente. Free .htaccess Online Generator body { padding-top: 2rem; padding-bottom: 2rem; } h3 { margin-top: 2rem; } h2 { font-size: 1.45rem; margin-top: 2rem; margin-bottom: 2rem; } form { padding-left:10px; } .row { margin-bottom: 1rem; } .row .row { margin-top: 1rem; margin-bottom: 0; } { padding-top: 1rem; padding-bottom: 1rem; background-color: rgba(86,61,124,.15); border: 1px solid rgba(86,61,124,.2); } hr { margin-top: 2rem; margin-bottom: 2rem; } .lead, small { padding-left:10px; } footer {padding: 2rem;} (function(w,d,s,l,i){w=w||;w.push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s), j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-K8V5396');
Free .htaccess Generator
Simple, free and online. Create, without error, your .htaccess file. Instructions Fill the options and push "generate" button in order to get your .htaccess file. The copy and paste the content into your .htaccess file. Remember, this file must be in the root of your site.
Public access options
Domain Example: domain.com (don't use www or http) Redirect http to https (SSL) Force www access (default is non www)
Config website
Prevent 404 errors for non-existing folders Default access page Example: index.php index.html (default is index.html) Default web charset Example: UTF-8 Force download (filetype) Example: .avi .pdf .mp4 Limit upload file size Example: 2147483647 (2GB) Administrator email Example: [email protected]
Performance
Enable Gzip compression Enable Keep-Alive header Expires Headers Example: 29030400 Time helper 30 min 1 hour 12 hours 1 day 1 week 1 month 1 year
Custom errors pages
Error 404 Example: error404.html Error 500 Example: error500.html
Security
Prevent directory navigation Disable CGI execution Hide information about web server technology Do not allow pages to be framed Disable server sign Block SPAM bots Prevent illegal or unsafe access (restrictive mode) Disallow script execution Example: .php .jsp .cgi Deny requests methods Example: get|post|put Prevent hotlinking Example: https://mydomain.com/mylogo.png Generate .htaccess Created by Emirodgar - Free htaccess generator $('#generateHtaccess').click( function() { var htaccess = ''; var domain = $('#htDomain').val(); var domainReg = domain.replace(/\./g,'\\.'); if (domainReg =='') domainReg = 'CHANGEDOMAIN\\.com'; var param = paramHttps = htaccessIllegal = htaccessSpam = ''; var rewrite = false; $('#htaccessFinal').val(''); htaccess += '\nRewriteEngine On'; if ($('#htHttps').is(":checked")) { paramHttps = 's'; htaccess += "\n\n#Redirect to SSL version"+ "\nRewriteCond %{HTTPS} off" + "\nRewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}"; } if ($('#htWww').is(":checked")) { htaccess += "\n\n#Redirect to www version"+ "\nRewriteCond %{HTTP_HOST} !^www\.(.*)$ " + "\nRewriteRule ^(.*)$ http"+paramHttps+"://www.%{HTTP_HOST}/$1"; } else { $param = 'www.'; htaccess += "\n\n#Redirect to non www version"+ "\nRewriteCond %{HTTP_HOST} ^www\.(.*)$ " + "\nRewriteRule ^(.*)$ http"+paramHttps+"://%1/$1 "; } //Config if ($('#ht404Redirect').is(":checked")) { htaccess += "\n\n#Prevent 404 en non-existing folders"+ "\nOptions -MultiViews"; } var htDefaultPage = $('#htDefaultPage').val(); if(htDefaultPage!=''){ htaccess += "\n\n#Default page"+ "\nDirectoryIndex "+htDefaultPage; } var htAdminEmail = $('#htAdminEmail').val(); if(htAdminEmail!=''){ htaccess += "\n\n#Default contact email"+ "\nSetEnv SERVER_ADMIN "+htAdminEmail; } var htForceDownload = $('#htForceDownload').val(); if(htForceDownload!=''){ htaccess += "\n\n#Force download"+ "\nAddType application/octet-stream "+htForceDownload; } var htWebCharset = $('#htWebCharset').val(); if(htWebCharset!=''){ htaccess += "\n\n#Default charset"+ "\nAddDefaultCharset "+htWebCharset; } var htFileSize = $('#htFileSize').val(); if(htFileSize!=''){ htaccess += "\n\n#Limit upload file size"+ "\nLimitRequestBody "+htFileSize; } //Performance if ($('#htGzip').is(":checked")) { htaccess += "\n\n#Gzip compression"+ "\n"+ "\n mod_gzip_on Yes"+ "\n mod_gzip_dechunk Yes"+ "\n mod_gzip_item_include file .(html?|txt|css|js|php|pl)$"+ "\n mod_gzip_item_include handler ^cgi-script$"+ "\n mod_gzip_item_include mime ^text/.*"+ "\n mod_gzip_item_include mime ^application/x-javascript.*"+ "\n mod_gzip_item_exclude mime ^image/.*"+ "\n mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*"+ "\n"; } if ($('#htKeepAlive').is(":checked")) { htaccess += "\n\n#Enable Keep-Alive Headers"+ "\n"+ "\n Header set Connection Keep-Alive"+ "\n"; } var htExpiresHeaders = $('#htExpiresHeaders').val(); var htExpiresHeadersFormat = $('#htExpiresHeadersFormat').val(); if(htExpiresHeaders!=''){ htaccess += "\n\n#Set Expires Headers"+ '\n'+ "\n ExpiresDefault A"+htExpiresHeaders+ "\n"; } //Error var htCustomError404 = $('#htCustomError404').val(); if(htCustomError404!=''){ htaccess += "\n\n#Default 404 error"+ "\ErrorDocument 404 "+htCustomError404; } var htCustomError500 = $('#htCustomError500').val(); if(htCustomError500!=''){ htaccess += "\n\n#Default 500 error"+ "\nErrorDocument 500 "+htCustomError404; } //Security if ($('#htDirectory').is(":checked")) { htaccess += "\n\n#Prevent directory navigation"+ "\nOptions All -Indexes"; } if ($('#htDisableCgi').is(":checked")) { htaccess += "\n\n#Disable CGI"+ "\nOptions -ExecCGI"; } if ($('#htDisableTech').is(":checked")) { htaccess += "\n\n#Hide PoweredBy"+ "\nHeader unset X-Powered-By"; } if ($('#htDisableFrame').is(":checked")) { htaccess += "\n\n#Do not allow pages to be framed"+ "\nHeader set X-Frame-Options SAMEORIGIN"; } if ($('#htDisableSign').is(":checked")) { htaccess += "\n\n#Disable server sign"+ "\nServerSignature Off"; } var htDisallowScript = $('#htDisallowScript').val(); if(htDisallowScript!=''){ htaccess += "\n\n#Disallow scripts execution"+ "\nAddHandler " +htDisallowScript; } var htDenyRequests = $('#htDenyRequests').val(); if(htDenyRequests!=''){ htaccess += "\n\n#Deny request method"+ "\nRewriteCond %{REQUEST_METHOD} !^("+htDenyRequests.toUpperCase()+")"+ "\nRewriteRule .? - "; } var htHotlinking = $('#htHotlinking').val(); if(htHotlinking!=''){ htaccess += "\n\n#Prevent hotlinking"+ "\nRewriteCond %{HTTP_REFERER} !^$"+ "\nRewriteCond %{HTTP_REFERER} !^http://(www\.)?"+domainReg+"/.*$ "+ "\nRewriteRule \.(gif|jpg|swf|flv|png)$ "+htHotlinking+" "; } if ($('#htSpamBots').is(":checked")) { rewrite= true; htaccessSpam = "\n\n #Block Spam Bots"+ "\n RewriteCond %{HTTP_USER_AGENT} ^(aesop_com_spiderman|alexibot|backweb|bandit|batchftp|bigfoot) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar) " + "\n RewriteCond %{HTTP_USER_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb) " + "\n RewriteCond %{HTTP_USER_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack) " + "\n RewriteCond %{HTTP_USER_AGENT} ^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).*$ " + "\n RewriteRule . - "; } if ($('#htIllegal').is(":checked")) { rewrite= true; htaccessIllegal = "\n\n #Block illegal or unsafe access"+ "\n RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) " + "\n RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* " + "\n RewriteCond %{HTTP_COOKIE} ^.*(|'|'|%0A|%0D|%27|%3C|%3E|%00).* " + "\n RewriteCond %{HTTP_USER_AGENT} ^.*(|'|'|%0A|%0D|%27|%3C|%3E|%00).* " + "\n RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* " + "\n RewriteCond %{QUERY_STRING} ^.*(|'|'|%0A|%0D|%27|%3C|%3E|%00).* " + "\n RewriteRule (.*) - "; } if (rewrite == true){ htaccess += "\n\n#Mod Rewrite"+ "\n"+ "\n RewriteEngine On"+ "\n Options +FollowSymlinks"+ "\n RewriteBase /"+ htaccessSpam+ htaccessIllegal+ "\n"; } $('#htaccessFinal').val(htaccess); } ); Guardas el *.html y lo ejecutas en tu navegador web favorito. Ejemplo...
Si crees que esta herramienta es útil, compártela. Read the full article















