CodeIgniter Forums
extra variables appear in url after leaving home page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: extra variables appear in url after leaving home page (/showthread.php?tid=11897)



extra variables appear in url after leaving home page - El Forum - 09-27-2008

[eluser]paulcj2[/eluser]
In my test site:
www.clickbasicsdemo.com/index.php
when one clicks on a link in the top navigation from the home page (for example the link "page") the link works fine. However, after arriving on "page" the urls contain extra variable "/page/clickbasicsdemo/", which is incorrect and brings up a 404 page not found error. Here's what I have done to configure the urls:
1) in the .htaccess file
RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

2) in config/config.php
$config['base_url'] = BASE_URL;

3) in config/constants.php
define('BASE_URL', 'http://clickbasicsdemo.com/');
define('SITE_ADDRESS', 'clickbasicsdemo');

4) in views/header.php
the top navigation link for "page" is <li><a href="page/clickbasicsdemo/444">page</a> </li>

What's my next troubleshooting step?


extra variables appear in url after leaving home page - El Forum - 09-27-2008

[eluser]paulcj2[/eluser]
Aha! I just created a new page: "product categories"
http://www.clickbasicsdemo.com/cats_prod
The url problem does not show up from the "product categories" page, so it must be the "Page" controller or view where the problem is.

I considered that naming a controller and view "Page" could be the problem. However, that name does not seem to be reserved by CodeIgniter:
http://ellislab.com/codeigniter/user-guide/general/reserved_names.html


extra variables appear in url after leaving home page - El Forum - 09-27-2008

[eluser]paulcj2[/eluser]
The problem may lie in my config/routes.php file.
Code:
$route['page/([a-z]+)/(:num)'] = "page/index/$1/$2";