eisenseinstein eisenseinstein - 6 months ago 60
PHP Question

Mixing of static and dynamic pages in CodeIgniter

I'm trying to mix static and dynamic content in a CodeIgniter 3.1 tailored website. I'm using the tutorial example given for the static content:

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

I'm afraid this would be quite messy for the purpose, since (:any) is too generic and I don't want to use something like

Any suggestions on how to achieve a solution that let me have a static and controller named friendly URL?

Every idea is welcome and very much appreciated.

As my question seems to be difficult to understand, I'll try to ask it once again:

Is there a way to combine static content with the above code (from codeigniter tutorial) and the usual approach
dynamic content handling?

Can you give an example?

Should I change
for every static webpage's name i.e.:

Thanks in advance


Consider this:

$route['(:any)'] = 'pages/view/$1';

In function get the name / Parameter by uri segment. Have a DB with - SEO URL and your controller/function - and Redirect to it.

Its an example. Try it with your app...!

Happy Coding!