• Resolved celinech

    (@celinech)


    Hi, I work on my staging site and I want to be sure to create the good link between pages. My pages are in the format ?page_id=xxx.

    • If I want to make links between page, which link must I insert ? (?page_id=xxx, the final url in production, ?)
    • When I will push the staging site online, will the page automatically be rewritten with the slug or must I change online, the canonical URL?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Rene Hermenau

    (@renehermi)

    @celinech

    First of all, I recommend activating postname permalinks on your staging site as described here:
    https://wp-staging.com/docs/activate-permalinks-staging-site/

    When working with a staging site and preparing to migrate it to production, it’s essential to consider how internal links will behave after the migration. Here’s how to manage links between pages with ?page_id=xxx URLs and ensure smooth migration:

    Linking Pages on the Staging Site

    1. Using ?page_id=xxx Format on Staging: If you link pages on your staging site using the ?page_id=xxx format (e.g., example.com/?page_id=123), these links will work correctly on production after migration. WordPress will recognize these page IDs and dynamically rewrite them with the correct slugs based on the permalink settings on the production site.
    2. Using Slug-Based URLs (Recommended): If you prefer to use the slug-based URLs (e.g., example.com/about-us) while working on staging, you can do so. However, be aware that these URLs will likely include your staging domain name until migration is complete. After migrating, you may need to replace instances of your staging domain in the database to reflect the production domain fully but usually WP Staging will replace all occurances properly.

    Handling URLs After Migration

    When you push the staging site to production using WP Staging Pro, there are typically two cases to consider regarding URL handling:

    1. Automatic Rewriting of URLs: WP Staging Pro can replace the staging URLs with production URLs during the migration process. If you’ve linked pages using the ?page_id=xxx format, WordPress will dynamically handle the slugs based on the new site’s permalink structure, so no additional work is needed.
    2. Canonical URLs: If your site uses canonical URLs, it’s good practice to verify that they reflect the correct production domain after migration. WP Staging Pro should handle most replacements automatically, but if there are hardcoded URLs (like canonical tags set in an SEO plugin), double-checking them after migration is recommended.

    Final Steps Post-Migration

    After pushing your staging site to production:

    • Flush Permalinks: Go to Settings > Permalinks on your production site and click Save Changes to ensure all permalinks are rewritten correctly.
    • Run a Search and Replace (if needed): If you used the staging domain in hardcoded links, you can use a search-and-replace tool in WP Staging Pro or a compatible plugin to update all instances to the production domain.

    By following these steps, your page links should function seamlessly on production without needing to rewrite them manually. If you encounter specific linking issues post-migration, WP Staging Pro support can provide additional assistance.

    Thread Starter celinech

    (@celinech)

    Hi Rene, thank you very much for your extended answer. I will follow your advice.
    Have a nice day

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.