Problem with regex and uri

#1
[eluser]Mareshal[/eluser]
This is what I want to do:

If I type http://localhost/domain.com => output domain.com

If I type http://localhost/domain.com/second_uri => generate error page(not 404 not found from ci). I don't want it to search and try to call "domain.com" controller

If I type http://localhost/controller/method => load my controller etc


Here are my methods from "main" controller:
Code:
function index(){
        
        $data['uri'] = "";    $data['extra'] = "";
                
        $data['uri'] = $this->uri->segment(1);
        
        $data['extra'] = $this->uri->segment(2);
        
        if(substr_count($data['uri'], ".") == 1 && substr_count($data['uri'], "com") == 1 && empty($data['extra']))
        
            $this->domain($uri);
                
        else
            
            $this->load->view('test/error');
        
        $data['query'] = $this->db->get('programs');
        
        $this->load->view('main/index', $data);
        
    }

    function domain($domain = ""){
        
        $domain = "";
        
        $data['uri'] = $this->uri->segment(1);
        
        $data['extra'] = $this->uri->segment(2);
        
        $this->load->view('test/domain', $data);
        
    }

... and modified routes:
Code:
$route['[a-zA-Z0-9\-\.]+\.(com|org|net|COM|ORG|NET)'] = "main/domain/$1";

Any ideas? Is emergency


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.