• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
routing issue

#1
[eluser]jmadsen[/eluser]
This has to be something simple and stupid and I'm just staring at it too hard.

My main countroller/function/param is

"site/page/my_param" (i.e., "http://localhost/smcms_seo/site/page/check_home_url/")


I want to be able to use:

http://localhost/smcms_seo/site/page/check/home/url/ <--- this is working
http://localhost/smcms_seo/site/page/check_home_url/ <--- this is working
http://localhost/smcms_seo/check_home_url/ <--- this is working

http://localhost/smcms_seo/check/home/url/ <--- this is NOT

I need this last one to work as well, but it just...isn't. It gives a "not directing properly" timeout.

(Don't worry about the last case $path variable - it is what makes "http://localhost/smcms_seo/check_home_url/" work.

Yes, I could write some dynamic code to add any number of (:any)'s, but not really a concern right now)

Code:
$route['site/page/(:any)/(:any)/(:any)'] = "site/page/$1_$2_$3";
$route['site/page/(:any)/(:any)'] = "site/page/$1_$2";
$route['site/page/(:any)'] = "site/page/$1/";
$route['site/(:any)'] = "site/$1";

$route['(:any)/(:any)/(:any)'] = "site/page/$1_$2_$3";  //why isn't this working?

$route['[^' . $path . ']?(:any)'] = "site/page/$1";

my .htaccess looks like this (but I've tried simpler versions and no change)

Code:
#check mod_rewrite is enabled
<IfModule mod_rewrite.c>

#enable mod rewrite
RewriteEngine On

#set working directory
RewriteBase /smcms_seo/

#force trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [R=301,L]

#bootstrap index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

#end mod rewrite check
</IfModule>


Thanks!

#2
[eluser]jmadsen[/eluser]
:ahhh:

where are the little cursing emoticons?

sorry, the code above is okay - traced it to some internal controller routing issues


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.