[eluser]dootzky[/eluser]
hi again guys :wow:
ok, I've got it working.
it's not nice, it's not pretty - but it DOES WORK!
first - your last idea with .htaccess didn't help, I was still getting "404 error" for "old link" (/domino/article.php?aid=84)
and then I did this, this is my working solution:
.htaccess file
Code:
RewriteEngine on
#Old urls first
RewriteRule article\.php /domino/article/index/ [R=301,L]
# Now the index.php
RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt)
RewriteRule ^(.*)$ /domino/index.php?/$1 [L]
my
routes.php setting:
Code:
...
$route['article/(\d+)'] = "article/index/$1";
...
and finally, my
article.php controller:
Code:
...
...
function index($id_article)
{
// if we don't get $id_article the normal way, try to hack the redirected URL, and get the ID..
// if even that fails -> show_404();
if (!$id_article) {
$url = explode('/', $_SERVER['REQUEST_URI']);
$fake_id = substr($url[4], 5, strlen($url[4]) - 5);
if (is_numeric($fake_id)) $id_article= $fake_id;
else show_404();
}
// do what you need to do here with your article..
}
...
...
so, for the normal page access, everything works. examples:
/domino/article/index/84 -> works
/domino/article/84 -> works
/domino/article/edit/84 -> works
and for the old "article.php" page attempt, this is what I get redirected to:
/domino/article.php?aid=84 =>
/domino/article/index/?aid=84
so - even if this is not "cool" solution, I somehow get to the "article" controller, and then I butcher the URL, and somehow I get the wanted ID. it will work for any ID length (84, 555, 1205, 44055 ..)
I really hope this will help someone else to get around the problems I've run to.
And of course, if someone here knows how do to this better - please do tell, I'll correct this solution then.
And once again - I would like to say
THANK YOU to both guys who've helped me out here, couldn't have done it without their help.
Cheers!
dootzky