-
Notifications
You must be signed in to change notification settings - Fork 384
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
With pretty permalinks enabled, adding /amp/ will break rewrite #860
Comments
Hi @Airell, I quickly spinned up a test site and cannot reproduce the issue, the redirect works fine on my side even with WordPress installed in a subdirectory. Which method described in this article are you using? I am closing this for now, it may be reopened if more people are facing the same issue |
Hi @ThierryA, I'm using method number 2, with URL change. I have copied .htaccess and the index.php and changed the root's index.php. The next rewrite works: Now with AMP, the URL is: But the rewrite from the previous example does not work when /amp/ is added to the url: I'm using the lastest Wordpress, my .htaccess is changed by Wordpress (step 11.) to:
Regards, Airell. |
Is there a resolution to this issue yet? I saw elsewhere guidance to change |
What version of the plugin are you using? The amp slug is not used anymore. Now in paired mode, the AMP version of a page is accessed via the |
The |
I am having this issue as well. Visiting the WP > Settings > Permalinks and clicking the [Save Changes] button appears to fix it, as well as running the CLI I am using version (1.1.3). I can't change the slug from /amp/ to ?amp as there's no option to do so in my AMP settings (classic mode). |
Aside: The latest version of the plugin is 1.2.0, not 1.1.3. What happens if you force the use of |
I'm testing on my install in Reader mode and when I do
|
Issue may have been reported here as well: https://wordpress.org/support/topic/plugin-does-not-appear-to-work-2/ |
@westonruter not sure who mkendall07 is .. but maybe you mistyped. I get 404 pages for both Yes .. |
@mkormendy sorry, yes, autocomplete problem. Please share the URL to your site. |
Because I've had this issue for some time, I have created a cron job that runs the |
I'm confused, though. Why would adding |
I lied again. So apparently You can test right now for the next 3 minutes (after which point the cron job will flush rewrites via CLI and fix https://www.smartstartinc.com/blog/easiest-ignition-interlock-device/?amp https://www.smartstartinc.com/blog/easiest-ignition-interlock-device/amp/ |
Ok, so for an immediate workaround I suggest adding this code to force the query param as opposed to the endpoint: add_filter( 'amp_pre_get_permalink', function( $pre, $post_id ) {
return add_query_arg( amp_get_slug(), '', get_permalink( $post_id ) );
}, 10, 2 ); |
I'll try the force, I may have to sit with our SEO Strategist to make a mark in her analytics if she gets changes in her expected attribution paths/urls. |
What matters is the Now, as for the underlying cause for why flushing rewrite rules doesn't work... I'm guessing the cause is a plugin calling |
For sure on the canonical, I do know that she has some specific tags/triggers set up for attributing our efforts in adding AMP to the site in the first place. As for the flush_rewrite_rules() firing too early, the process that triggers that and breaks it has to do with WP Migrate Pro .. which I use for automating the migration of specific tables, forms and content from our staging environment to live and vice versa. |
I'm going to close this in favor of #2204, where we should move to using |
Thanks @westonruter! |
When pretty permalinks enabled, AMP will add /amp/ to the url, but this will break the automatic rewrite rule when you set the site address different from the wordpress address.
My wordpress address is 'blog.oracle48.nl/wordpress', but in WP settings I have set 'blog.oracle48.nl' as site address. This will make 'blog.oracle48.nl/wordpress/post/' goto 'blog.oracle48.nl/post/' and works out of the (wordpress) box.
But whem /amp/ is added (by LinkedIn or other site), this rewrite does not work any more. 'blog.oracle48.nl/wordpress/post/amp/' does not get rewritten to 'blog.oracle48.nl/post/amp/' and visitors will be shown the 404 page.
The text was updated successfully, but these errors were encountered: