Route gives me a 404 |
[eluser]pigfox[/eluser]
My url looks like: http://domain.com/index/e/1 The route looks like: $route['index/e/(:num)'] = "index/e/$1"; But it gives me a 404. This works: $route['index/e/1'] = "index"; I'm trying to generate: http://domain.com/index/e/X Where X is any integer. My controller looks like: $this->load->helper('url'); $error = $this->uri->segment(3); I'm trying to get the "X" into $error. Does anyone know?
[eluser]maria clara[/eluser]
instead of Code: $route[‘index/e/(:num)’] = “index/e/$1”; try Code: $route[‘index/e/(:any)’] = “index/e/$1”;
[eluser]pigfox[/eluser]
This gives me a 404: $route['index/e/(:any)'] = "index/e/$1"; This gave me a blank screen: $route[‘index/e/(:any)’] = “index/e/$1”; This is my .htaccess file: RewriteEngine on #RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond $1 !^(index\.php|images|robots\.txt|css|js|files|modules|assets|managedb) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] Don't know if that affects anything.
[eluser]maria clara[/eluser]
try this in your .htaccess: Code: RewriteEngine on
[eluser]pigfox[/eluser]
The .htaccess file looks like this now: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php/$1 [L] But I still get a 404 when I go to: http://www.pigfox.com/index/e/1
[eluser]pigfox[/eluser]
I renamed everything to Home/home: //controllers/home.php class Home extends Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); } function index() { $error = $this->uri->segment(3); echo $error; $this->load->view('header', $error); $this->load->view('home'); $this->load->view('footer'); } } views/home.php Just HTML, no php code at all /config/config.php $config['index_page'] = ""; /config/routes.php $route['default_controller'] = "home"; $route['home/e/(:any)'] = "home/e/$1"; My url: http://www.mydomain.com/home/e/1 still gives me a 404 The following urls work fine: http://www.mydomain.com/home http://www.mydomain.com What have I missed? |
Welcome Guest, Not a member yet? Register Sign In |