I'm using a PHP router (AltoRouter) that allows me to define routes in all sorts of manners but doesn't do any kind of redirecting.
I want my '/' route to remain as is.
But if someone goes to anything other than '/' I have a wildcard route that grabs the name of that route, locates a twig file, and renders it based on name. So '/about' would locate about.twig
and render it.
What I want to achieve is if someone goes to '/about' or '/contact', etc, then they'd be re-routed to '/pages/about', '/pages/contact', etc, but if they go to '/pages/about' directly then no re-route necessary.
My current .htaccess file looks like this:
RewriteEngine on
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
Unfortunately I did a bunch of searching around and didn't really find how to do that specific conditional re-route/redirect. Especially not one that left the root '/' alone.
P.s. pages
isn't actually a directory on the server. I just want to insert 'pages' before the page name.