0

I have a static HTML content that is used as a promotional landing page for our website, so it doesn't need to have Magento headers, footers, etc. Just a static landing page.

I put the whole landing page folder mylandingpage/ into pub/ folder and can access it by going to www.mysite.com/mylandingpage/index.html

However i want to modify the URL to make it more SEO friendly, so i went to Marketing/SEO & Search/URL Rewrites and create a new custom URL Rewrite with 'Request Path' as 'newlanding' and 'Target Path' is 'mylandingpage/index.html'. But www.mysite.com/newlanding is throwing 404.

Am i missing anything else?

2 Answers 2

1

As you're writing content in an html file, outside the scope of magento so I think magento router controller/ url rewrite would not work on it.

You can rewrite the url using your .htaccess file, just add following code your .htaccess located on magento's root ;

RewriteEngine On
RewriteRule ^mylandingpage\/index\.html$ /newlanding/ [R=301,L]

It should rewrite www.mysite.com/mylandingpage/index.html to www.mysite.com/newlanding/

2
  • We will have a lot more landing pages in the future and these landing pages could come from 3rd party outsourcing companies that will have their own stylesheets and javascript files so i was trying to isolate them into a specific folder and manage their SEO links through Magento, but that sounds like i can't do that then. Thanks for your answer, it might be the only solution. Commented Oct 31, 2018 at 23:01
  • You can always use server side rewrite in htaccess. Please mark the answer as accepted if it worked for you. Commented Oct 31, 2018 at 23:04
1
  1. First you haven't to add your files in /pub folder because it is a generated one.

  2. Simply to add your content file after base url www.mysite.com/newlanding, you just have to create a cms page Admin > Content cms page you put a name as newlanding you save, then call it in your url as your exemple then you will have you landing page.

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.