Hi. I'm migrating an old website mostly made of static pages to OctoberCMS but I wanna keep URLs the same as much as possible. One of the issues is that the old website uses DirectoryIndex successfully and works both with <rest_of_url>/ and <rest_of_url>/index.html but I have to choose one of them. I also know how to use .htaccess to redirect all URLs ending with .html to / but this is not what I want. I just want a user to see the same page by entering <rest_of_url>/ or <rest_of_url>/index.html into the browser and without redirect. Can you please help me?
Probably the quickest and easiest way to do this is to just duplicate the page under / and /index.html
Thanks, Luke, but what about the maintenance? I always try to avoid duplicates. Isn't there any better idea?
Sure, you could define a route in a custom plugin's routes.php and have it return
(new Cms\Classes\Controller)->run('/index.html'); but really it's six of one and half a dozen of another when it comes to maintaining that setup. If you're not really going to be updating the page frequently then you could just live with the duplicated files, or if you'd like to take another approach you could have two pages (one
/ and one
/index.html) that contain nothing but a single partial, and then have the page content actually managed in that partial instead.
There's lots of different ways you could handle this, it's just up to you which approach you want to take.
1-5 of 5