views:

27

answers:

2

I want to make my system redirect unknown requests such as www.address.com/a_company to the adress www.address.com/companies/company/ and display the company a_company if it exists in the database, otherwise throw the user to a 404 not found page.

So in detail, I want to make namespace that is as the first example dynamically, if the company exist in the database, I have no problem connecting to the database and retrieving information or finding a way to parse a company name, I just need help how to make my system check and run a function every time the address doesn't exist and show the second page (/companies/company/)..

I am using an Acl as well, but I think it should be fine if the page is /companies/company and then possibly add /?c=a_company or similar.

Thank you. /Marcus

A: 

simply create a front controller plugin which checks the request params agains the database before the request is dispatched.

zolex
A: 

Well, my problem is to keep the url, I would like my $this->url('controller' => 'comapanies', 'action' => 'company', 'c' => 'a_company'); to link to the /a_company adress too.

It would be possible to add to the dispatched, however without knowing how to use namespaces or routing correct I'm still unable to achieve what I want.

I tried route, however it dint't help me as it did rewrite all my $this->url() links to the same url I routed too.

It worked perfect as it was, but somehow it removed my standard routings, I just want to route it away if the controller doesn't exist or if it is easier to check the database if the company exists.

Oldek