{"id":23582471,"url":"https://github.com/fork/craft-here","last_synced_at":"2025-05-06T23:44:26.116Z","repository":{"id":62506588,"uuid":"323903956","full_name":"fork/craft-here","owner":"fork","description":"Use the SEO plugin redirects to write nginx and apache redirect map config files (perfect for headless Craft CMS Setups)","archived":false,"fork":false,"pushed_at":"2025-02-28T16:09:43.000Z","size":55,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-17T04:21:10.272Z","etag":null,"topics":["apache","craftcms","headless","nginx","redirect","routing"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-23T13:04:07.000Z","updated_at":"2025-02-28T16:09:48.000Z","dependencies_parsed_at":"2024-12-27T01:11:44.409Z","dependency_job_id":"6df3e118-1f5e-49de-964b-846b4f405087","html_url":"https://github.com/fork/craft-here","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-here","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-here/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-here/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-here/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fork","download_url":"https://codeload.github.com/fork/craft-here/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788404,"owners_count":21804280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","craftcms","headless","nginx","redirect","routing"],"created_at":"2024-12-27T01:11:41.799Z","updated_at":"2025-05-06T23:44:26.110Z","avatar_url":"https://github.com/fork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"left\"\u003e\n  \u003cimg width=\"600\" title=\"Craft Here\" src=\"/resources/img/plugin-logo.png\"\u003e\n\u003c/div\u003e\n\n**Table of contents**\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Roadmap](#roadmap)\n\n\u003c!-- /TOC --\u003e\n\n---\n\n## Features\n\n- Manage custom redirects directly within the server configuration (for Nginx and Apache)\n- Perfectly suited for headless Craft CMS Setups\n- Use the redirects features and UI of the [Craft SEO Plugin](https://github.com/ethercreative/seo)\n\n## Requirements\n\n- Craft CMS 5\n- [Craft SEO Plugin](https://github.com/ethercreative/seo)\n\n## Setup\n\n**1. Install**\n\nInstall the package\n\n```sh\ncd /path/to/project\ncomposer require fork/craft-here\n```\n\n**2. Configuration file**\n\n- Copy the example `config.php` to your Craft config directory and rename it to `redirects.php`\n- Specify the server type (and a reload command if you use nginx). Here's an example:\n\n```php\n\u003c?php\n\nreturn [\n    // Global settings\n    '*' =\u003e [\n        'serverType' =\u003e 'nginx' // or 'apache'\n    ],\n\n    // Dev environment settings\n    'dev' =\u003e [\n        //'redirectsReloadCommand' =\u003e 'my-command',\n    ],\n\n    // Staging environment settings\n    'staging' =\u003e [\n    ],\n\n    // Production environment settings\n    'production' =\u003e [\n        //'redirectsReloadCommand' =\u003e 'sudo /etc/init.d/nginx reload',\n    ],\n];\n```\n\nIn your server configuration include the redirect map files (which will be created after plugin has been installed):\n\n```nginx\n# NGINX EXAMPLE:\n\n# see https://serverfault.com/a/890715/487169 for why we use \"[.]\" instead of a regular period \".\"\ninclude /var/www/html/redirects/my.domain.com/redirects-301[.]map;\ninclude /var/www/html/redirects/my.domain.com/redirects-302[.]map;\n\n# 301 MOVED PERMANENTLY\nif ($redirect_moved = false) {\n    set $redirect_moved \"\";\n}\nif ($redirect_moved != \"\") {\n    rewrite ^(.*)$ $redirect_moved permanent;\n}\n# 302 FOUND (aka MOVED TEMPORARILY)\nif ($redirect_found = false) {\n    set $redirect_found \"\";\n}\nif ($redirect_found != \"\") {\n    rewrite ^(.*)$ $redirect_found redirect;\n}\n```\n\n```apacheconf\n# APACHE EXAMPLE:\n\nRewriteEngine On\nRewriteMap redirects-301 txt:/var/www/html/redirects/my.domain.com/redirects-301.map\nRewriteMap redirects-302 txt:/var/www/html/redirects/my.domain.com/redirects-302.map\n\nRewriteCond ${redirects-301:%{REQUEST_URI}} ^.+$\nRewriteRule .* https://${redirects-301:%{HTTP_HOST}%{REQUEST_URI}} [redirect=permanent,last]\n\nRewriteCond ${redirects-302:%{REQUEST_URI}} ^.+$\nRewriteRule .* https://${redirects-302:%{HTTP_HOST}%{REQUEST_URI}} [redirect=temp,last]\n```\n\n## Usage\n\nOnce the plugin has been installed it will create all necessary redirect map files which need to be included into the server config.\nAfter that just use the SEO Plugin UI to manage your redirects.\n\n## Roadmap\n\n- [ ] Settings maybe (instead of config file)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/resources/img/heart.png\" width=\"38\" height=\"41\" alt=\"Fork Logo\" /\u003e\n\n  \u003cp\u003eBrought to you by \u003ca href=\"https://www.fork.de\"\u003eFork Unstable Media GmbH\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffork%2Fcraft-here","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffork%2Fcraft-here","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffork%2Fcraft-here/lists"}