Passing multiple parameters in htacess and including files based on them
I currently am working on a project where I have to pass three parameters
in the url. My url looks like -
localhost/newproject/index.php?file_name=clients&mode=edit&id=1
The functions that I perform when passing different parameters are listed
below
1) url - localhost/newproject/index.php?file_name=clients
Function - include the file templates/modules/clients/clients.php
2) url - localhost/newproject/index.php?file_name=clients&mode=edit
Function - include the file template/modules/clients/cliemts-edit.php. And
the clients-edit screen will be used to add a new client as the client id
is not set.
3) url - localhost/newproject/index.php?file_name=clients&mode=edit&id=1
Function - include the file template/modules/clients/cliemts-edit.php. And
the clients-edit screen will be used to update the client whose client_id
is 1. Now, I am trying to convert this url to this
localhost/newproject/clients/edit/1
I have the following code in my htaccess
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ index.php?file_name=$1&mode=$2&id=$3
[L]
RewriteRule ^([^/\.]+)$ index.php?file_name=$1 [L]
The problem that I am facing is that whenever the clients-edit screen gets
included, the path of the css files, javascript files and the images get
changed. How can I overcome this?
No comments:
Post a Comment