Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Kohana] The requested URL / was not found on this server.
Forum PHP.pl > Forum > PHP > Frameworki
pifarek
Witam.
Mam serwer na linuxpl.com, wgrałem tam aplikację na Kohana 3.3, ustawiłem .htaccess i bootstrap.php, do serwera jest podpięta domenta. Po wpisaniu adresu w przeglądarkę pokazuje się błąd Kohany: "The requested URL / was not found on this server.".
bootstrap.php:
  1. Kohana::init(array(
  2. 'base_url' => '/',
  3. 'index_file' => false
  4. ));

.htaccess:
  1. # Turn on URL rewriting
  2. RewriteEngine On
  3.  
  4. # Installation directory
  5. RewriteBase /
  6.  
  7. # Protect hidden files from being viewed
  8. <Files .*>
  9. Order Deny,Allow
  10. Deny From All
  11. </Files>
  12.  
  13. # Protect application and system files from being viewed
  14. RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
  15.  
  16. # Allow any files or directories that exist to be displayed directly
  17. RewriteCond %{REQUEST_FILENAME} !-f
  18. RewriteCond %{REQUEST_FILENAME} !-d
  19.  
  20. # Rewrite all other URLs to index.php/URL
  21. RewriteRule .* index.php/$0 [PT]


Na hostingu jest podpięta jeszcze inna domena, na której działa Kohana w jakiejś starszej wersji z gałęzi 3.x, bootstrap i htaccess są ustawione tak samo, jak powyżej. W czym może być problem?
r4xz
"The requested URL / was not found on this server."
routing... albo nie masz zdefiniowanego dla "/", albo nie może znaleźć odp. akcji/kontrolera
pifarek
Cytat(r4xz @ 11.11.2012, 16:13:18 ) *
routing... albo nie masz zdefiniowanego dla "/", albo nie może znaleźć odp. akcji/kontrolera

A coś więcej podpowiesz na ten temat?
r4xz
Cytat(pifarek @ 11.11.2012, 16:39:18 ) *
A coś więcej podpowiesz na ten temat?


to może zapytam tak, czy jeśli masz ustawienia domyślne (tj. kod poniżej) to masz ten błąd?
  1. Route::set('default', '(<controller>(/<action>(/<id>)))')
  2. ->defaults(array(
  3. 'controller' => 'welcome',
  4. 'action' => 'index',
  5. ));

+ w folderze application/classes/Controller/Welcome.php klasę class Controller_Welcome extends Controller z public function action_index()?

najlepiej pokaż swój routing i obiekt której dotyczy
pifarek
u mnie to wygląda tak:
  1. Route::set('default', '(<action>)')
  2. ->defaults(array(
  3. 'controller' => 'index',
  4. 'action' => 'index',
  5. ));
  6.  
  7. Route::set('admin', 'admin/<action>')
  8. ->defaults(array(
  9. 'directory' => 'admin',
  10. 'controller' => 'index'
  11. ));
  12.  
  13. Route::set('feed', 'feed/<action>')
  14. ->defaults(array(
  15. 'directory' => 'feed',
  16. 'controller' => 'index',
  17. 'action' => 'index',
  18. ));
  19.  
  20. Route::set('news', 'news/<news>(/<action>)')
  21. ->defaults(array(
  22. 'directory' => 'news',
  23. 'controller' => 'index',
  24. 'action' => 'index',
  25. ));
  26.  
  27. Route::set('user', 'user/<username>(/<action>)')
  28. ->defaults(array(
  29. 'directory' => 'user',
  30. 'controller' => 'index',
  31. 'action' => 'index',
  32. ));
  33.  
  34. Route::set('user_ajax', 'user/ajax/<action>')
  35. ->defaults(array(
  36. 'directory' => 'user',
  37. 'controller' => 'ajax',
  38. 'action' => 'index',
  39. ));
  40.  
  41. Route::set('game', 'game/<game>(/<tab>)', array('tab' => 'play|report'))
  42. ->defaults(array(
  43. 'directory' => 'game',
  44. 'controller' => 'index',
  45. 'action' => 'index',
  46. ));
  47.  
  48. Route::set('game_ajax', 'game/ajax/<action>')
  49. ->defaults(array(
  50. 'directory' => 'game',
  51. 'controller' => 'ajax',
  52. 'action' => 'index',
  53. ));
  54.  
  55. Route::set('activate', 'activate,user.<username>,code.<code>')
  56. ->defaults(array(
  57. 'controller' => 'index',
  58. 'action' => 'activate',
  59. ));
  60.  
  61. Route::set('ajax', 'ajax/<action>')
  62. ->defaults(array(
  63. 'controller' => 'ajax',
  64. 'action' => 'index',
  65. ));

i wszystko działa na localhoscie :/
r4xz
1. a jak wygląda dostępność .htaccess w ustawieniach (obstawiam że) Apache?
2. żeby obalić teorię 1 sprawdź czy inne podstrony chodzą
3. upewnij się że istnieje w controller/index.php metoda action_index
klocu
Ja tylko dorzucę, bo sam to przerabiałem przy migracji:

Cytat
PSR-0 support (file/class naming conventions)
With the introduction of PSR-0 support, the autoloading of classes is case sensitive. Now, the file (and folder) names must match the class name exactly.


.htaccess nie zmieniał się od wielu wersji (chyba że ktoś używa możliwie nowej wersji apache'a, która Order Deny,Allow każe sobie zapisać inaczej - krócej)
gothye
wyczyść cache
pifarek
Cytat(klocu @ 11.11.2012, 22:12:52 ) *
Ja tylko dorzucę, bo sam to przerabiałem przy migracji:



.htaccess nie zmieniał się od wielu wersji (chyba że ktoś używa możliwie nowej wersji apache'a, która Order Deny,Allow każe sobie zapisać inaczej - krócej)

Wychodzi na to, że to właśnie tego wina. Ale nie podoba mi się, że muszę teraz każdy plik nazywać z dużej litery i miliard klas w kodzie typu url::base() zmieniać na URL::base() ohmy.gif !

Dzięki wszystkim!
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.