{"id":4474,"date":"2025-02-26T21:53:30","date_gmt":"2025-02-27T03:53:30","guid":{"rendered":"https:\/\/linuxitos.com\/main\/?p=4474"},"modified":"2025-03-08T11:20:26","modified_gmt":"2025-03-08T17:20:26","slug":"usar-url-directa-en-laravel-12","status":"publish","type":"post","link":"https:\/\/linuxitos.com\/main\/usar-url-directa-en-laravel-12\/","title":{"rendered":"Usar URL directa en Laravel 12"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"656\" src=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19-1024x656.png\" alt=\"\" class=\"wp-image-4475\" srcset=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19-1024x656.png 1024w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19-300x192.png 300w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19-768x492.png 768w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/Screenshot-From-2025-02-26-21-34-19.png 1267w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">Contexto:<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">El d\u00eda 24 de febrero del 2025, se lanz\u00f3 la versi\u00f3n 12 de laravel. Un framework con PHP. En lo personal y para versiones en desarrollo, se me facilita m\u00e1s configurar el entorno y el acceso a los proyectos usando XAMPP y usando una url directa, es decir, usar localhost\/nombre-proyecto en lugar de lanzar el proyecto con el comando artisan serve, simplemente porque es m\u00e1s simple.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/laravel.com\">https:\/\/laravel.com<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Configuraci\u00f3n<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">1.- Instalar un proyecto nuevo con el siguiente comando:<\/h3>\n\n\n\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: white; font-family: menlo, monaco, monospace; font-style: inherit; font-weight: inherit; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;\">composer create-project laravel\/laravel proyecto<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Esperar que termine de descargar los archivos<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.- Copiar el archivo index.php del directorio de public\/ y pegarlo en la ruta ra\u00edz del proyecto<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Buscar las l\u00edneas siguientes, y modificar como se muestra:<\/p>\n\n\n\n<pre style=\"background: rgb(245, 245, 245); border-radius: 6px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333; font-family: menlo, monaco, monospace; font-style: inherit; font-weight: inherit; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;\">[...]\nrequire __DIR__.'\/..\/vendor\/autoload.php';\n\n$app = require_once __DIR__.'\/..\/bootstrap\/app.php';\n[...]\n\nModificar a:\n\n[...]\nrequire __DIR__.'\/vendor\/autoload.php';\n\n$app = require_once __DIR__.'\/bootstrap\/app.php';\n[...]\n\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3.- Crear el archivo .htaccess en el directorio ra\u00edz del proyecto<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Disable directory browsing\nOptions All -Indexes\n\n# ----------------------------------------------------------------------\n# Rewrite engine\n# ----------------------------------------------------------------------\n\n# Turning on the rewrite engine is necessary for the following rules and features.\n# FollowSymLinks must be enabled for this to work.\n&lt;IfModule mod_rewrite.c>\n\tOptions +FollowSymlinks\n\tRewriteEngine On\n\n\t# If you installed CodeIgniter in a subfolder, you will need to\n\t# change the following line to match the subfolder you need.\n\t# http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html#rewritebase\n\t# RewriteBase \/\n\n\t# Redirect Trailing Slashes...\n\tRewriteCond %{REQUEST_FILENAME} !-d\n    \tRewriteRule ^(.*)\/$ \/$1 &#91;L,R=301]\n\n\t# Rewrite \"www.example.com -> example.com\"\n\tRewriteCond %{HTTPS} !=on\n\tRewriteCond %{HTTP_HOST} ^www\\.(.+)$ &#91;NC]\n\tRewriteRule ^ http:\/\/%1%{REQUEST_URI} &#91;R=301,L]\n\n\t# Checks to see if the user is attempting to access a valid file,\n    # such as an image or css document, if this isn't true it sends the\n    # request to the front controller, index.php\n\tRewriteCond %{REQUEST_FILENAME} !-f\n\tRewriteCond %{REQUEST_FILENAME} !-d\n\tRewriteRule ^(.*)$ index.php\/$1 &#91;L]\n\n\t# Ensure Authorization header is passed along\n    RewriteCond %{HTTP:Authorization} .\n    RewriteRule .* - &#91;E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n&lt;\/IfModule>\n\n&lt;IfModule !mod_rewrite.c>\n    # If we don't have mod_rewrite installed, all 404's\n    # can be sent to index.php, and everything works as normal.\n    ErrorDocument 404 index.php\n&lt;\/IfModule><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.- Asignar permisos a directorios del proyecto, y de storage<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Permisos al proyecto<\/p>\n\n\n\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: white; font-family: menlo, monaco, monospace; font-style: inherit; font-weight: inherit; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;\">sudo chmod 775 -R proyecto<\/pre>\n\n\n\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: white; font-family: menlo, monaco, monospace; font-style: inherit; font-weight: inherit; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;\">sudo chown -R daemon:blip proyecto<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Permisos a storage<\/p>\n\n\n\n<pre style=\"background: rgb(54, 63, 72); border-radius: 6px; border: 0px; box-sizing: border-box; color: white; font-family: menlo, monaco, monospace; font-style: inherit; font-weight: inherit; line-height: 15.68px; margin-bottom: 1.1em; max-width: 100%; outline: 0px; overflow: auto; padding: 13.125px 16.4062px; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;\">sudo chmod 777 proyecto\/storage -R<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5.- Acceder a la URL del proyecto desde el navegador<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/localhost\/proyecto\">http:\/\/localhost\/proyecto<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"632\" src=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image-1024x632.png\" alt=\"\" class=\"wp-image-4476\" srcset=\"https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image-1024x632.png 1024w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image-300x185.png 300w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image-768x474.png 768w, https:\/\/linuxitos.com\/main\/wp-content\/uploads\/2025\/02\/image.png 1493w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Gracias por visitar.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contexto: El d\u00eda 24 de febrero del 2025, se lanz\u00f3 la versi\u00f3n 12 de laravel. Un framework con PHP. En lo personal y para versiones en desarrollo, se me facilita m\u00e1s configurar el entorno y el acceso a los proyectos usando XAMPP y usando una url directa, es decir, usar localhost\/nombre-proyecto en lugar de lanzar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4475,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[167,7,998,929,1511],"tags":[2023,1561,1638,1913,2024,1587],"class_list":["post-4474","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-actualizar-phpmyadmin-de-xampp","category-fedora","category-lampp","category-mysql-server","category-server","tag-api","tag-fedora","tag-laravel","tag-public","tag-url","tag-xampp"],"_links":{"self":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/4474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/comments?post=4474"}],"version-history":[{"count":1,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/4474\/revisions"}],"predecessor-version":[{"id":4477,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/4474\/revisions\/4477"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media\/4475"}],"wp:attachment":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media?parent=4474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/categories?post=4474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/tags?post=4474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}