{"id":13760161,"url":"https://github.com/pablopunk/nextjs-redirect","last_synced_at":"2025-10-24T05:06:46.288Z","repository":{"id":34918277,"uuid":"190215411","full_name":"pablopunk/nextjs-redirect","owner":"pablopunk","description":"HOC to redirect to any URL in NextJS both in client and server","archived":false,"fork":false,"pushed_at":"2024-04-27T14:34:20.000Z","size":1366,"stargazers_count":145,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T00:38:42.473Z","etag":null,"topics":["dynamic","hacktoberfest","hoc","nextjs","redirect"],"latest_commit_sha":null,"homepage":"https://pablopunk.github.io/nextjs-redirect/","language":"JavaScript","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/pablopunk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-06-04T14:13:50.000Z","updated_at":"2025-09-20T14:22:00.000Z","dependencies_parsed_at":"2024-04-27T15:43:18.782Z","dependency_job_id":null,"html_url":"https://github.com/pablopunk/nextjs-redirect","commit_stats":{"total_commits":109,"total_committers":7,"mean_commits":"15.571428571428571","dds":0.6788990825688073,"last_synced_commit":"0f94cb286d0527e1ae6e6cbdb7d6c1944a275237"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/pablopunk/nextjs-redirect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablopunk%2Fnextjs-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablopunk%2Fnextjs-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablopunk%2Fnextjs-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablopunk%2Fnextjs-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pablopunk","download_url":"https://codeload.github.com/pablopunk/nextjs-redirect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablopunk%2Fnextjs-redirect/sbom","scorecard":{"id":717229,"data":{"date":"2025-08-11","repo":{"name":"github.com/pablopunk/nextjs-redirect","commit":"ab2ddd38368de8793eb553089b7e303adc8eb82e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/cypress.yml:1","Warn: no topLevel permission defined: .github/workflows/static-export.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cypress.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/pablopunk/nextjs-redirect/cypress.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cypress.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/pablopunk/nextjs-redirect/cypress.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/static-export.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/pablopunk/nextjs-redirect/static-export.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/static-export.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/pablopunk/nextjs-redirect/static-export.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-f82v-jwr5-mffw","Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc","Warn: Project is vulnerable to: GHSA-g77x-44xx-532m","Warn: Project is vulnerable to: GHSA-7gfc-8cq8-jh5f","Warn: Project is vulnerable to: GHSA-qpjv-v59x-3qc4","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T10:04:50.841Z","repository_id":34918277,"created_at":"2025-08-22T10:04:50.841Z","updated_at":"2025-08-22T10:04:50.841Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280742528,"owners_count":26382926,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dynamic","hacktoberfest","hoc","nextjs","redirect"],"created_at":"2024-08-03T13:01:04.538Z","updated_at":"2025-10-24T05:06:46.266Z","avatar_url":"https://github.com/pablopunk.png","language":"JavaScript","readme":"# nextjs-redirect\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/pablopunk/miny\"\u003e\u003cimg src=\"https://img.shields.io/badge/made_with-miny-1eced8.svg\" style=\"display:inline\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nextjs-redirect\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/nextjs-redirect.svg?color=6c5ce7\" style=\"display:inline\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://packagephobia.now.sh/result?p=nextjs-redirect\"\u003e\u003cimg src=\"https://packagephobia.now.sh/badge?p=nextjs-redirect\" style=\"display:inline\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ci\u003eRedirect to any URL in NextJS both in client and server\u003c/i\u003e\n\u003c/p\u003e\n\n## Install\n\n```sh\nnpm install nextjs-redirect\n```\n\n## Usage\n\nLet's say you want to create a page `/donate` that redirects the user to paypal.me with a default value for the money. You create the page as you always do in NextJS (`pages/donate.js`) and then just use this component with the URL you want:\n\n```js\n// pages/donate.js\nimport redirect from 'nextjs-redirect'\nexport default redirect('https://paypal.me/pablopunk/5')\n```\n\nYou can checkout this example live in [pablopunk.com](https://pablopunk.com)\n\n### Status code (301, 302...)\n\nBy default, it will send a [301 status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection). This can be customized by an optional parameter:\n\n```js\nredirect('https://google.es', { statusCode: 302 })\n```\n\n### Client side dynamic routes (as)\n\nWhen redirecting on the client side, if the redirected page is dynamic (`pages/user/[userId]/info.js`), the following redirect will trigger a page refresh:\n\n```js\nredirect('/user/42/info')\n```\n\nIn this case you can use the `asUrl` option to make a smooth transition between pages without any refresh:\n\n```js\nredirect('/user/[userId]/info', { asUrl: '/user/42/info' })\n```\n\n### Static export\n\nThis package is compatible with `next export` since version 4.0.0. See [PR #4](https://github.com/pablopunk/nextjs-redirect/pull/4) for more details.\n\n### Custom UI component (HOC)\n\nIn case the navigation is happening client-side, you can use this package as a HOC to provide your custom components/styles for the UI:\n\n```jsx\nimport redirect from 'nextjs-redirect'\n\nconst Redirect = redirect('https://github.com/pablopunk')\n\nexport default () =\u003e (\n  \u003cRedirect\u003e\n    \u003cMyLayout\u003eRedirecting to github!\u003c/MyLayout\u003e\n  \u003c/Redirect\u003e\n)\n```\n\n### Redirect to URL from parameters\n\nLet's say you have a single page called `/redirect`, and you wanna use it for all kinds of redirects:\n\n* `/redirect?to=https://google.com`\n* `/redirect?next=https://twitter.com`\n* `/redirect?url=https://pablopunk.com`\n\nPretty cool huh!? You can do this with `nextjs-redirect` by passing the name of the parameter you want on the url. For the examples above:\n\n```ts\n// NOTE: These are 3 separate examples, you can only choose one name per page\nredirect('to', {params: true})\nredirect('next', {params: true})\nredirect('url', {params: true})\n```\n\n## Related\n\nWorking with locales routes? Take a look at [nextjs-redirect-locale](https://github.com/pablopunk/nextjs-redirect-locale).\n\n## Native redirects\n\nThere's now a native way of handling redirects on NextJS. You can read more about it [here](https://nextjs.org/blog/next-9-5#support-for-rewrites-redirects-and-headers). It requires you to modify your `next.config.js`. Personally I still think `nextjs-redirect` is a more friendly way of doing it, and also more flexible. For example you can do dynamic redirects on the server, depeding on the request, which is useful when working with locales (checkout [nextjs-redirect-locale](https://github.com/pablopunk/nextjs-redirect-locale)) and other request-dependent redirects. It also allows you make client redirects with a custom layout.\n\n## License\n\nMIT\n\n## Author\n\n| ![me](https://gravatar.com/avatar/fa50aeff0ddd6e63273a068b04353d9d?size=100) |\n| ---------------------------------------------------------------------------- |\n| [Pablo Varela](https://pablopunk.com)                                        |\n","funding_links":["https://paypal.me/pablopunk/5'"],"categories":["JavaScript","Nextjs Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablopunk%2Fnextjs-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpablopunk%2Fnextjs-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablopunk%2Fnextjs-redirect/lists"}