I have a Home.php
controller and terms
method in it. I have a url like this: https://www.example.com/terms
and it works fine.
My routes.php
:
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['terms'] = 'home/terms';
Now, I need to change the url to be like this: https://www.example.com/#/terms
Notice the "#" in-between.
I tried adding this to routes but it didn't work:
$route['#/terms'] = 'home/terms';
The above change show home page when I open https://www.example.com/#/terms
However, if I put any other permitted character $config['permitted_uri_chars']
mentioned in conifg.php
in place of # then it works fine:
$route['a/terms'] = 'home/terms'; // this works: https://www.example.com/a/terms
$route['2/terms'] = 'home/terms'; //this works: https://www.example.com/2/terms
I also added # in $config['permitted_uri_chars']
but that too didn't work. Keeps showing home page only.
Also, can anyone explain me why # is not treated the same way as other characters in permitted_uri_chars
?
Controller is Home.php
and method is terms()
. Using CodeIgniter version 3.1.11
Thank You!
EDIT:
I need to know if I can achieve it using Codeigniter's routing? Or maybe some rewrite rule using .htaccess?