Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CodeIgniter] problem z .htaccess
james8
post 27.12.2012, 09:54:51
Post #1





Grupa: Zarejestrowani
Postów: 134
Pomógł: 0
Dołączył: 29.07.2008

Ostrzeżenie: (0%)
-----


Witam,

Mam problem z CodeIgniterem, chciałem pozbyć się z adresu index.php i wrzuciłem plik .httacces do głównego katalogu, jednak serwer wypluwa błąd "INTERIAL SERVER ERROR".

htaccess wygląda następująco:

RewriteEngine on
RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]


Edit: korzystam z serwera LinuxPL.com
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
kilab
post 27.12.2012, 10:16:10
Post #2





Grupa: Zarejestrowani
Postów: 180
Pomógł: 19
Dołączył: 4.11.2007

Ostrzeżenie: (0%)
-----


Popraw na tak:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]


--------------------
Go to the top of the page
+Quote Post
szok
post 27.12.2012, 10:27:42
Post #3





Grupa: Zarejestrowani
Postów: 165
Pomógł: 20
Dołączył: 2.03.2006

Ostrzeżenie: (0%)
-----


Cytat(kilab @ 27.12.2012, 10:16:10 ) *
Popraw na tak:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]


Wywal katalog system, nie potrzeba do niego dostępu.


--------------------
Go to the top of the page
+Quote Post
james8
post 8.01.2013, 10:51:50
Post #4





Grupa: Zarejestrowani
Postów: 134
Pomógł: 0
Dołączył: 29.07.2008

Ostrzeżenie: (0%)
-----


Cytat(kilab @ 27.12.2012, 10:16:10 ) *
Popraw na tak:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]



Niestety nadal: 500 Internal Server Error

EDIT:

Problem rozwiązany, dzięki doskonałej pomocy technicznej smile.gif

Problem nie leżał po stronie pliku .htaccess tylko edytra! Używam Eclipse PHP (zawodowego edytora jakby nie patrzeć a pomimo to doklejał znacznik: <FEFF> na początku pliku) albo doklejał to klent FTP fillezilla.

Dziekuje za pomoc problemos rozwiązany!

Cytat(szok @ 27.12.2012, 10:27:42 ) *
Wywal katalog system, nie potrzeba do niego dostępu.


szok proszę powiedz czy katalog system jest potrzebny na serwerze? czy można go usunąć?

Ten post edytował james8 30.12.2012, 16:40:38
Go to the top of the page
+Quote Post
szok
post 8.01.2013, 11:47:19
Post #5





Grupa: Zarejestrowani
Postów: 165
Pomógł: 20
Dołączył: 2.03.2006

Ostrzeżenie: (0%)
-----


Tak, bo tam CI trzyma wszystkie swoje pliki.
Ale możesz go wstawić wyżej niż publi_html i wtedy w index.php zmieniasz ścieżke do katalogu ../system i po sprawie smile.gif


--------------------
Go to the top of the page
+Quote Post
james8
post 8.01.2013, 14:50:53
Post #6





Grupa: Zarejestrowani
Postów: 134
Pomógł: 0
Dołączył: 29.07.2008

Ostrzeżenie: (0%)
-----


Cytat(szok @ 8.01.2013, 11:47:19 ) *
Tak, bo tam CI trzyma wszystkie swoje pliki.
Ale możesz go wstawić wyżej niż publi_html i wtedy w index.php zmieniasz ścieżke do katalogu ../system i po sprawie smile.gif


Dziękuję za odpowiedź Szok smile.gif

Mam jeszcze jedno pytanie, chciałem się pozbyć index.php z linku strony, użyłem pliku .httaccess, oraz w pliku config.php usunąłem "index.php"z linijki: $config['index_page'] = '';

Jednak aby wywołać kontroler muszę wpisywać cały adres http://adres_strony/index.php/kontroler

Czy wiesz może co robię źle?
Go to the top of the page
+Quote Post
szok
post 8.01.2013, 18:59:07
Post #7





Grupa: Zarejestrowani
Postów: 165
Pomógł: 20
Dołączył: 2.03.2006

Ostrzeżenie: (0%)
-----


Bez index.php nie działa? tzn że z plikiem .htaccess nadal jest coś nie tak.


--------------------
Go to the top of the page
+Quote Post
james8
post 8.01.2013, 21:34:39
Post #8





Grupa: Zarejestrowani
Postów: 134
Pomógł: 0
Dołączył: 29.07.2008

Ostrzeżenie: (0%)
-----


Cytat(szok @ 8.01.2013, 18:59:07 ) *
Bez index.php nie działa? tzn że z plikiem .htaccess nadal jest coś nie tak.


http://domena/index.php/kontroler działa

http://domena/kontroler nie działa (dostaje komunikat: No input file specified.)

Mój .htaccess wygląda następująco:

RewriteEngine on
RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]

A może to wina serwera może coś z mod_rewrite?

Problem rozwiązany! smile.gif

httacsess powinien wyglądać następująco:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

Ten post edytował james8 8.01.2013, 21:16:04
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 26.06.2025 - 10:03