'/' is giving problem in url routing |
[eluser]Unknown[/eluser]
hi, I’m new to CI and i am working on CI from past 5 months.. i am getting problem with '/' in url routing the following routes are working fine on windows os. $route['^archives/cu/cat_index.html$'] = "archives/cat_index"; $route['^archives/([A-Za-z_]+)/([0-9]+)/([A-Za-z_]+).html$'] = "archives/cu"; $route['^archives/([A-Za-z_]+)/([A-Za-z]+)_index.html$'] = "archives/cu"; $route['^archives/([A-Za-z_]+)/([0-9]+)_index.html$'] = "archives/cu"; $route['^articles/([0-9]+),([0-9]+),([0-9_]+),([0-9]+),([0-9]+),([0-9]+).html$'] = "archives/articles_display"; $route['^articles/(daily)/([0-9]+),([0-9_]+),([0-9]+),([0-9]+),([0-9]+).html$'] = "archives/articles_display"; $route['^articles/(newsletter)/([0-9]+),([0-9_]+),([0-9]+),([0-9]+),([0-9]+).html$'] = "archives/articles_display"; but same routes are not working in linux os.. but if i put '/' at the end of url (ex.. www.xxx.com/index.html/) it is working but for my page ranking i can't put '/' at the end. please help........
[eluser]batteries[/eluser]
did you try removing the ^ and $ from the routes? i don't think they're needed. Edit: are you using mod_rewrite at all? also, use: \d+ instead of [0-9]+, it will shorten up those huge routes you got there.
[eluser]Unknown[/eluser]
Thanks for reply........... i tried by removing the ^ and $ from the routes, but there is no difference in the result.... i am using mod_rewrite. my .htaccess file contains the following content RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^(index\.php|images|captcha|js|css|ads|uploads|robots\.txt|favicon\.ico) RewriteRule ^(.*)$ index.php/$1 [L]
[eluser]marcoss[/eluser]
Yes, the $ is not needed, but if that doesn't work you can try to add the slash to the controller so it gets triggered, that would be this 'archives/cu/' instead of this 'archives/cu'.
[eluser]batteries[/eluser]
try adding a "?" in: Code: RewriteRule ^(.*)$ index.php/$1 [L] to this Code: RewriteRule ^(.*)$ index.php?/$1 [L] |
Welcome Guest, Not a member yet? Register Sign In |