Welcome Guest, Not a member yet? Register   Sign In
Change route for root
#8

(08-22-2018, 02:27 AM)Pertti Wrote: Updating your htaccess is well explained here - https://www.codeigniter.com/user_guide/g...x-php-file

I can't remember in what order routing happens, but if the tag itself is dynamic, you have two options.

If you can allow controller reference in the URL - myproject.com/mycontroller/11h11 :
PHP Code:
class Mycontroller extends CI_Controller
{
 
   // ...
 
   public function _remap()
 
   {
 
       echo $this->uri->segment(2);
 
   }


If it must be first element of URL myproject.com/11h11 (this may not work, you need to test it yourself, but it may or may not override autolinking to controllers):
PHP Code:
$route['(:any)'] = 'whc/mymethod/$1'

PHP Code:
class Whc extends CI_Controller
{
 
   // ...
 
   public function mymethod($tag null)
 
   {
 
       echo $tag;
 
   }


Thanks
Is is OK
Reply


Messages In This Thread
Change route for root - by omid_student - 08-21-2018, 02:41 AM
RE: Change route for root - by InsiteFX - 08-21-2018, 02:09 PM
RE: Change route for root - by omid_student - 08-21-2018, 10:36 PM
RE: Change route for root - by jreklund - 08-22-2018, 01:00 AM
RE: Change route for root - by Pertti - 08-22-2018, 01:25 AM
RE: Change route for root - by omid_student - 08-22-2018, 01:40 AM
RE: Change route for root - by Pertti - 08-22-2018, 02:27 AM
RE: Change route for root - by omid_student - 08-22-2018, 03:01 AM
RE: Change route for root - by InsiteFX - 08-22-2018, 03:33 AM
RE: Change route for root - by omid_student - 08-22-2018, 09:34 AM
RE: Change route for root - by Pertti - 08-23-2018, 01:16 AM
RE: Change route for root - by InsiteFX - 08-23-2018, 03:33 AM
RE: Change route for root - by omid_student - 08-23-2018, 05:44 AM
RE: Change route for root - by omid_student - 08-23-2018, 06:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB