Few of my project urls contains the parenthesis and it is a codeigniter project. Unfortunately I cant remove them.
So I am writing following rules in my route.php of config folder:
$route['abc-(def)'] = 'locations/index/12492';
$route['abc-%28def%29'] = 'locations/index/12492';
$route['404_override'] = 'home/pagenotfoundhandler';
So when I am trying to access URL http://mydomain.com/abc-(def) or http://mydomain.com/abc-%28def%29 it takes me to home/pagenotfoundhandler, while it should take me to location controller and index method. Please suggest how to deal with parenthesis in codeigniter.
Well I guess that is because the page http://mydomain.com/abc-(def)
which is supposed to redirect to locations/index/12492
can not be found! so a 404 - Page not Found
error takes place, which of course as you have defined takes you to home/pagenotfoundhandler
! make sure the path exists or even why do not you give the complete path to see if it works!
The parentheses are a part of the regex pattern, so try escaping them if you want to use them as ascii characters like this:
$route['abc-\(def\)'] = 'locations/index/12492';
And one more place to look:
There should be a allowed uri characters setting in config.php for your codeigniter system. check there if parentheses are allowed.
Alternatively, you can disable $config["csrf_protection"]
to skip url xss cleaning.