I have a pretty old website (running on Apache) that serves around 50 static HTML pages. And so I want to change it and add PHP Router to help me serve content in a RESTful way.
Now I have tried several things, but I don't know how good they are.
Say I have old page example.com/fooBar.html
I want to be able to serve it from example.com/foo/bar
and:
- keep old website link versions accessible from outside:
example.com/fooBar.html
- make all requests go through
index.php
where I can use PHP Router, serve proper content for requests, keep old meta tags content intact (RESTful URIs should have same exact data) - NOT have ugly links like this:
example.com/index.php?page=foo/bar
- keep old version of a website's Google rating somewhat same
- keep 301 Redirects to a minimum (2 is max I guess?)
- change all website's inner links to new RESTful versions
So far I see that I can reference old pages to index like so:
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?url=$0 [QSA,L]
This sends old pages to index.php
and I can route Old Resources to New Ones like so:
Changing location with router: $response->header("Location", "/foo/bar");
So the goal is for the location to look like example.com/foo/bar
:
"example.com/fooBar.html" => index.php Router => "example.com/foo/bar"
"example.com/foo/bar" => index.php Router => "example.com/foo/bar"
Is there a better way?