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

Preview URL 301 redirect #118

Open
kestraly opened this issue Oct 18, 2022 · 7 comments
Open

Preview URL 301 redirect #118

kestraly opened this issue Oct 18, 2022 · 7 comments

Comments

@kestraly
Copy link

We've recentlly updated the connector, however it appears to now be 301 redirecting preview links to the blog base

On closer inspection it appears to be due to the ending /

https://www.domain.com/blog/?p=3313&preview=true&preview_time=1666101335 <!-- 301 redirections to https://www.domain.com/blog

https://www.domain.com/blog?p=3313&preview=true&preview_time=1666101335 <!-- Preview is correct

It might be related to another module cropping trailing slashes. We're still investigating at this phase, but wanted to flag because this is an issue for stores that do crop trailing slashes

@bentideswell
Copy link
Owner

To fix trailing slash issues, ensure that the trailing slash configuration is the same in Magento and WordPress. You should change WordPress to use the same configuration as Magento.

WordPress determines whether to use a trailing slash based on the permalink structure at WP Admin > Settings > Permalinks. If the URL structure here has a trailing slash then all WP URLs will.

From the look of it, your Magento site does not use a trailing slash so make the permalink structure in WordPress also does not use a trailing slash.

@kestraly
Copy link
Author

kestraly commented Oct 18, 2022

Thanks for replying so quickly Ben. Interestingly, there is no trailing slash only custom url /%postname%

If i click on use post name I get /%postname%/

I'll have a play around and see what happens

EDIT -- Just to keep this all in one place.

Adding the trailing slash /%postname%/ in Wordpress permalinks and the preview function works again

@bentideswell
Copy link
Owner

Great, thanks for confirming. I think this is resolved so I will close the issue, but if the issue is still open or comes back, feel free to re-open and comment again.

@kestraly
Copy link
Author

Sort of resolved. Doesn't work when I remove the / again.

I'm just going to leave the ending / on for the moment so the previews work

@bentideswell
Copy link
Owner

Could Magento be redirecting the URLs? Do all URLs with trailing slashes redirect?

@kestraly
Copy link
Author

Yeah, all other URL's remove the trailing slash. It's being used in conjunction with Mageworx SEO Suite, so I suspect it is something to do with that.

If I turn on trailing slash on wordpress, it remains on the blog section and isn't removed, so that is particularly strange situation if it's being affected for previews, but not if it's intentionally being added.

@bentideswell
Copy link
Owner

Does disabling Mageworx SEO resolve the issue? I've tried recreating locally but I can't trigger the redirect

@bentideswell bentideswell reopened this Oct 19, 2022
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

No branches or pull requests

2 participants