Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redirect status when set to permanent #691

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

lucymtc
Copy link
Contributor

@lucymtc lucymtc commented Jan 31, 2024

Description of the Change

When using a tool like Safe Redirect Manager users can set the status code of the redirect to 301, in this case the redirect should be permanent.
The status code could be set to other values from the plugin, this would be a different case as NextJS redirect only supports accepts permanent: true|false

This fix at least allows some level of control from Safe Redirect Manager or other redirect plugins.

How to test the Change

  • Run WP with Safe Redirect Manager plugin.
  • Add a redirect with status code 301
  • Go to the front end and check in Network tab the redirect is 308 which is the equivalent of the 301 permanent redirect.
  • Change status to 307 in Safe Redirect Manager and check in the front end the redirect is now 307 temp redirect

Changelog Entry

Added - New feature
Changed - Existing functionality
Deprecated - Soon-to-be removed feature
Removed - Feature
Fixed - Bug fix
Security - Vulnerability

Credits

Props @username, @username2, ...

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

Copy link

changeset-bot bot commented Jan 31, 2024

🦋 Changeset detected

Latest commit: 7f78556

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@headstartwp/next Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
headstarwp ✅ Ready (Inspect) Visit Preview Jan 31, 2024 2:26pm

@lucymtc lucymtc requested a review from nicholasio January 31, 2024 14:26
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headless_framework

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@nicholasio nicholasio merged commit e0e7c82 into develop Jan 31, 2024
11 checks passed
@nicholasio nicholasio deleted the fix/redirect-status-code branch January 31, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants