0

I haven't really used the Marketing > SEO & Search: Url rewrites much over the past few years. It seems pretty straight forward but I can't figure out why it's blowing out the content of the page after the rewrite is set.

Below is a page that I've setup a custom permanent(301)

https://www.website.com/

website.com/prettyURL < redirects to here but page has no content.

It should just look like this page: https://www.website.com/index/index/find/

They all have the same look and feel just different cities or towns. If I was to apply a redirect to the above link I get the same behavior.. no more content. Just a page that says:

The page you were looking for can't be found. etc etc etc etc

1 Answer 1

1

Your destination page 'waverly' doesn't exist. Even if it did this isn't going the work the way you're envisioning it. When you forward the request by 301 to 'waverly' your 'find-a-builder' controller is no longer being used and magento goes looking for a (cms/category/product) page with 'waverly' as the url. The destination page doesn't inherit the controller logic.

My assumption is you're looking for all builder locations to automatically have vanity urls for ease of use and seo purposes. To do this you'll need to modify the 'find-a-builder' module with the following requirements.

  • Update the 'builders' database table (or whatever it's called) and admin interfaces to include a property for 'display_url' and either populate it manually when managing builder locations or have the system automatically create a slug url based on the builder name. Enforce this as a unique value.
  • Create a custom router to go outside of the normal 'frontname/controller/action/params' pattern. Check for the desired frontname and then lookup the builder record by 'display_url' based on the param (waverly in your example). Set the controller values and forward the request.
  • Update your 'find a builder' learn more links to use the new pattern.
  • To really button this up I'd recommend you update the sitemap generator to also include the builder locations using the new pattern.

It should be possible to end up with a url pattern like 'builder/waverly' or 'builder/whatever' and have it display the same layout and dynamic content that would normally be found on '/find-a-builder/index/view/id/19'

How to create custom route in magento2

1
  • Thanks, that was very clear. I didn't think the native seo url rewrites would be able to handle this. Perhaps it's better to search the marketplace for a cheap module that already does this.. i know they want to work fast.
    – Singleton
    Oct 11, 2023 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.