CodeIgniter Forums

Full Version: Some help..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4

El Forum

[eluser]xwero[/eluser]
Remove the url suffix and you should be able to reach http://www.site.com/lists/1. I'm not sure if you use the url suffix configuration is removed before the url is routed so you could try
Code:
$route['/([a-z]+)/(\d+)\.html'] = "main/$1/$2";

El Forum

[eluser]adamp1[/eluser]
Wait so why not have make it so each static page has its own controller, instead of each static page having a method in a controller?

El Forum

[eluser]oriceon[/eluser]
http://localhost/site/lists.html 404 Page Not Found

El Forum

[eluser]oriceon[/eluser]
Because this is the single method find by me to not showing controller in URL. I want static pages to not show controller..

El Forum

[eluser]adamp1[/eluser]
Right well I just built the system you described on my server using the following routes:
Code:
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";

$route['lists/(\d+)'] = 'main/lists/$1'

And it works, btw you don't put the .html into the regex

El Forum

[eluser]xwero[/eluser]
I confirmed it the url suffix is removed before the routes are parsed so the suffix doesn't matter
The http://localhost/site/lists.html example doesn't work because it's not in the routes configuration, you need to add
Code:
$route['/([a-z]+)'] = "main/$1";
for that url to be routed.

edit: @adamp1 i wasn't sure so it could have been the problem, but it isn't Smile

El Forum

[eluser]oriceon[/eluser]
Still doesn`t work :| I`ve trying both examples and nothing.. same 404

El Forum

[eluser]xwero[/eluser]
First i want to make sure: http://localhost/site/ is your base url, right?

edit : i made a newbie mistake, again, the slash at the beginning of the route
Code:
$route['([a-z]+)'] = 'main/$1';

El Forum

[eluser]adamp1[/eluser]
Yer, Im never sure with damn regex and routing, that's why I had to go and build it to see myself.

El Forum

[eluser]adamp1[/eluser]
Wait a sec, are you making the call to index.php???

you should be accessing
Code:
http://localhost/site/index.php/lists/1.html

You can only miss the index.php out of you have url re-writing in an .htaccess file
Pages: 1 2 3 4