Reputation: 1978
I am using codeigniter to develop a web app
but i am facing some issues in url structure.
I need to have a url structure like below
http://example.com/controller/function/parameters
it means i am having a url like below
http://183.83.52.151/ftp/deploy/a72520c9987ca4b4255c10db9d76d3cb
in that url the string a72520c9987ca4b4255c10db9d76d3cb
is a parameter i want to get it in my php code but its taking this as a whole url and returning me 404page
how i can get this done ?
My htaccess looks like below
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|css|js|install|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [l,QSA]
My Code Looks like below
class ftp extends CI_Controller{
public function deploy(){
var_dump($_REQUEST); exit;
}
}
Upvotes: 0
Views: 193
Reputation: 424
use this as it
class Ftp extends CI_Controller{
public function deploy($id){
var_dump($id); exit;
}
}
and name the file is Ftp.php
Upvotes: 1
Reputation: 4491
Use URI class of codeigniter:
$data = $this->uri->segment(n); // in your case, it is $this->uri->segment(3);
echo $data;
See the link: URI Class
Upvotes: 0