Welcome Guest, Not a member yet? Register   Sign In
Url rewriting
#1

[eluser]Prokium[/eluser]
Hi,
I have a little problem with url rewriting on my app.
My app is an " intranet "

I have many class like : project, client, user
Theses class have same method like: show, add, edit, delete, liste etc..

I do this :
Code:
RewriteRule ^client/([a-zA-Z]+)/?$ client/show/$1  [L]
     # it's to have myapp.com/client/googlecorp/ point to client/show/googlecorp/
    RewriteRule ^client/([a-zA-Z]+)/modifier/?$ client/edit/$1  [L]
     # to have myapp.com/client/googlecorp/modifier point to client/edit/googlecorp/
    RewriteRule ^client/([a-zA-Z]+)/supprimer/?$ client/delete/$1  [L]

     #  myapp.com/client/googlecorp/supprimer point to client/delete/googlecorp/
    
      #RewriteRule ^client/ajouter/?$ client/add/  [L]

That's good.

But, if I want to add a new client ( with my "add" method call client->add [ client/add in CI ] ) it's not good because the url is rewrite

from

myapp.com/client/ajouter
to
myapp.com/client/show/ajouter


apache thinks that "add" is a "real" client, than he must think that it is a method.

I tested some thing like that:

Code:
RewriteCond %{REQUEST_URI} ^client/ajouter?$

but it does'nt work.

I hope you know what i mean...

Thank you very much for your Help!
#2

[eluser]Michael Wales[/eluser]
Why are you using mod_rewrite for issues that CodeIgniter's URI rewriting can handle easily...

Code:
$route['client/ajouter/'] = 'client/add';
$route['client/([a-zA-Z]+)/modifier'] = 'client/edit/$1';
// *tsk, tsk* A destructive method handled by GET - say hello to CSRF exploitation
$route['client/([a-zA-Z]+)/supprimier'] = 'client/delete/$1';
$route['client/([a-zA-Z]+)'] = 'client/show/$1';
#3

[eluser]Prokium[/eluser]
thx Michael. I will test.

See you later

edit : that's good!
Smile




Theme © iAndrew 2016 - Forum software by © MyBB