Redirect CMS pages for different store views

Created by Katie Bui, Modified on Mon, 01 Apr 2019 at 10:20 AM by Katie Bui

Question:

We have 4 stores with pages for all stores, the contact page url can look like:

sitename.se/kontakt

sitename.com/contact

When it's different url's it's not redirecting to that contact page, spelled in the language for that country. It just redirects to the home page. Is there a solution for this? 


Answer:


Check demo site http://demom2.bsscommerce.com/magento2-geoip-auto-switch-store/admin/ - Magento 2.1.7 - GeoIP 1.2.9
Precondition:
You have 4 store view with 4 different languages
=> Regarding About us page, each store view will have one cms page, each cms page has an url key (with the relevant language) (Since Magento does not support configuring 1 cms page for store view)
And our module only supports switching store views, not supporting switching cms pages


Solution: (We're using our demo site as an example)

Step 1: With 2 store views: Canada, Us http://prntscr.com/n4l3ki
- Canada store view has About Us page's URL with "about-us-ca"
- Us store view  has About Us page's URL with "about-us"


Step 2: 
Module's logic: User accesses Us store view with url servername/us/about-us is redirected to Canada store view with url servername/ca/about-us
Hence, at step 2, we create Url Rewrite to redirect user from servername/ca/about-us to servername/ca/about-us-ca (CA Store view's About us page url) http://prntscr.com/n4kwqk
- To redirect customer from US store view to CA store view, you have to create URL rewrite also http://prntscr.com/n4kwhf
=> The logic when customer is redirected from US Store view About us to CA store view About US is: servername/us/about-us > servername/ca/about-us > servername/ca/about-us-ca


Note: 
If you have many store views on site, the number of cms page needed to create is very huge -> number of url rewrite is very huge also.
Hence, we suggest you use our Import/export url rewrites modules for Magento 2.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article