Monday 15 August 2011

php - CodeIgniter URI Routing URI Segment and htaccess -


I am facing a URI routing problem, I'm sure someone here can help me solve . I'm running enough to stabilize my brain. Ok, here is the condition

CodeIgniter version: 2.1.3

I rooted two pages in the application / config / routes.php

$ route ['Sites / (: any)'] = 'profile / professional';

$ route ['/ sites: (any) / (: any)'] = 'profile / professional / $ 1';

I have a controller: Profile

A method inside the profile:

  Public function professional () {$ user = $ this-> Gt; Uri-> Section (3); $ Current_page = $ this- & gt; Yuri- & gt; Segment (4); Switch ($ current_page) {about 'case': $ this- & gt; Data ['content'] = 'user_sites / about_view'; break; Default: $ this- & gt; Data ['content'] = 'user_sites / home_view'; break; } $ This- & gt; Load-> View ('my_view', $ this- & gt; data); }   

Now if I load

www.mysite.com/sites/some_user/

this is just fine load. And the routing work is fine (I have an htaccess file to remove index.php)

but when I try to load

www.mysite.com/sites/ Some_user / about /

this load (blank page) is used. However, this route is actually working. Because when I load

www.mysite.com/sites/ index.php / some_user / about /

load it using my switch in the controller

So I think that I have to add a line or two code to my .htaccess file? Any help please? My current The Htaccess file looks like this

  Rewrite code on rewriting% {REQUEST_FILENAME}! -f Rewrite Convert% {REQUEST_FILENAME}! -d Recruitment Rule ^ (. *) $ Index.php? / $ 1 [L]   

Moderrite is also turned on.

Thank you very early ...

I think that you have made your segments Counting and your codex has found a mistake about the keyword in Segment 4, so this URL will be found in www.mysite.com/sites/index .php / some_user / about

Note that here the index The FTP is not actually the index page because this site is after the controller and it refers to it as a segment ( It is not an HTACAC for possible.))

If you remove index.php, then about section number www.mysite.com/sites/some_user/about

Located in 3

No comments:

Post a Comment