CodeIgniter Forums
URI Routing Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: URI Routing Problem (/showthread.php?tid=42546)



URI Routing Problem - El Forum - 06-10-2011

[eluser]Unknown[/eluser]
I've been utilising Codeigniter's URI routes feature (in CI 2.0.2) to produce SEO friendly URL's in my applications.

I've used this feature many times before (in both this release, and previous releases) and never had any problems, but I'm currently trying to use the following route, and it is failing (producing a 'Not Found' web page).

Code:
$route['public-sector'] = "main/public_sector";

I've read through the Codeigniter documentation for URI Routing (http://ellislab.com/codeigniter/user-guide/general/routing.html) but have been unable to find an answer to my problem.

The only possible solution I can think of is that there is a restriction on using the word 'public' at the start of your route?

Can anyone confirm this?

Other than that...I'm stumped. Any help would be greatly appreciated!!

========== UPDATE ==========

I've investigated further and I *think* that the request for the 'public-sector' URL is being prevented by my .htaccess file:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|public|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I have a 'public' folder that has my css, images, and js files inside it, and I think that this is the reason why the public-sector URL is not being served.

Does anyone have any suggestions (short of changing the name of my public folder, and changing all the paths to my image, css and js files).


URI Routing Problem - El Forum - 06-10-2011

[eluser]osci[/eluser]
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

Code:
RewriteCond %{REQUEST_FILENAME} !-f
checks if an existing file is specified and routes there if true.


URI Routing Problem - El Forum - 06-10-2011

[eluser]Unknown[/eluser]
Thanks for your speedy respone. Exactly what I needed Smile
First time posting in the forums, and the Codeigniter community comes straight to my aid. Fantastic!!