0
votes

i have following route in route.php in codeigniter

$route['^(?!login|signup|autos|jobs|jobwanted|admin).*'] = "pages/bpages"; 

it is redirecting everthing to pages/bpages except (login|signup|autos|jobs|jobwanted|admin )

eg www.mysite.com/sohailanwarpk

as sohailanwapk is not in (autos|jobs|jobwanted|admin) it will redirected to pages/bpages the problem i am facing is in that condition if my url is like

eg www.mysite.com/autosss

eg www.mysite.com/jobs123

it should direct autosss or jobs123 to "pages/bpages"; but its not,so how can i exaclty match (autos|jobs|jobwanted|admin) so that everything else will be redirected.

2
I get it that you want jobs to pass, jobs123 or fooo too fail. But what about jobs/123? - Rocco
i have rules in htaccess for these..(login|signup|autos|jobs|jobwanted|admin) these are basically controllers - Sohail Anwar

2 Answers

1
votes

Split it into 2 routes:

$route['^(?!(login|signup|autos|jobs|jobwanted|admin)).*']  = "pages/bpages";
$route['^(login|signup|autos|jobs|jobwanted|admin)[^\/].*'] = "pages/bpages";
0
votes

Just write 2 rules:

$route['^(login|signup|autos|jobs|jobwanted|admin)$'] = '$1';
$route['(:any)'] = 'pages/bpages';