Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z htaccess
adrian1987
post
Post #1





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 23.12.2005

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


mam taki problem, w katalogu głównym mam zdefiniowany plik htaccess o następującej treści:
  1. <?php
  2. # $Id: .htaccess 1739 2007-12-20 00:52:16Z hpdl $
  3. #
  4. # This is used with Apache WebServers
  5. #
  6. # For this to work, you must include the parameter 'Options' to
  7. # the AllowOverride configuration
  8. #
  9. # Example:
  10. #
  11. # <Directory "/usr/local/apache/htdocs">
  12. #   AllowOverride Options
  13. # </Directory>
  14. #
  15. # 'All' with also work. (This configuration is in the
  16. # apache/conf/httpd.conf file)
  17.  
  18. # The following makes adjustments to the SSL protocol for Internet
  19. # Explorer browsers
  20.  
  21. #<IfModule mod_setenvif.c>
  22. #  <IfDefine SSL>
  23. #    SetEnvIf User-Agent ".*MSIE.*"
  24. #             nokeepalive ssl-unclean-shutdown
  25. #             downgrade-1.0 force-response-1.0
  26. #  </IfDefine>
  27. #</IfModule>
  28.  
  29. # If Search Engine Friendly URLs do not work, try enabling the
  30. # following Apache configuration parameter
  31.  
  32. # AcceptPathInfo On
  33.  
  34. # Fix certain PHP values
  35. # (commented out by default to prevent errors occuring on certain
  36. # servers)
  37.  
  38. # php_value session.use_trans_sid 0
  39. # php_value register_globals 1
  40.  
  41. Options +FollowSymLinks
  42. RewriteEngine On
  43. RewriteBase /
  44.  
  45. RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
  46. RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
  47. RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
  48. RewriteRule ^(.*)-pi-([0-9]+).html$ popup_add_image.php?pID=$2&%{QUERY_STRING}
  49. RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
  50. RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
  51. RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
  52. RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
  53. RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
  54. RewriteRule ^(.*)-n-([0-9]+).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
  55. ?>

problem jest taki, że po kliknięciu na jakiś link wyświetla się komunikat:
  1. Not Found
  2. The requested URL /information.php was not found on this server.
  3.  
  4. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

a wszystkie pliki są w tym folderze... nie bardzo mam pojęcie o htaccess... wiecie gdzie może być problem?
problem dotyczy tej strony link
Go to the top of the page
+Quote Post
michaJlS
post
Post #2





Grupa: Zarejestrowani
Postów: 83
Pomógł: 9
Dołączył: 21.05.2004
Skąd: Glogau/Breslau

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


Może trzeba zmienić ścieżke w "RewriteBase /" albo w ogóle tą dyrektywę usunąć.
Go to the top of the page
+Quote Post
blooregard
post
Post #3


Newsman


Grupa: Moderatorzy
Postów: 2 033
Pomógł: 290
Dołączył: 21.12.2007
Skąd: Łódź




Sprawdź tu:

RewriteBase /

Zamień na:
RewriteBase /sklep_test


--------------------
Life's simple... You make choices and don't look back...
Go to the top of the page
+Quote Post
adrian1987
post
Post #4





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 23.12.2005

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


Po zmianie na RewriteBase /sklep_test
wyświetla się taki komunikat:
Pętla przekierowań
Firefox wykrył, że serwer przekierowuje żądanie tego zasobu w sposób uniemożliwiający jego ukończenie.
Go to the top of the page
+Quote Post
erix
post
Post #5





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Poczytaj sobie, co to są dwie flagi:
  • [L]
  • [QSA]
Bo one są Tobie potrzebne.


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
adrian1987
post
Post #6





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 23.12.2005

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


może jeszcze jakąś podpowiedźquestionmark.gif bo poczytałem o tych flagach i nie bardzo wiem co z tym zrobić... to nie jest mój kod, ja go muszę jedynie zmodyfikować... a z htaccess do tej pory niewiele miałem doczynienia...
jak zastosowałem tą flagę [L] to nie przerwało mi to zapętleń jak zmieniłem RewriteBase /sklep_test... a przy RewriteBase / cały czas wyświetla komunikat, że nie może znaleźć określonego pliku na serwerze...
Go to the top of the page
+Quote Post
erix
post
Post #7





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




  1. pokaż, co dokładnie zrobiłeś
  2. sprawdź, czy wszystkie ścieżki są na pewno ok


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
adrian1987
post
Post #8





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 23.12.2005

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


już wiem dlaczego nie chce mi zobaczyć tego plików na serwerze:
na serwerze mam taką ścieżkę: public_html/sklep_test/ i tutaj są wszystkie pliki od strony wraz z htaccess. ale jak kliknę na jakiś link to reguły przekierowują mnie do katalogu public_html... znaczy się jest coś nie tak z RewriteBase / Tylko jak to powinno być, żeby wchodziło do tego katalogu sklep_test? Jak wpiszę
  1. # $Id: .htaccess 1739 2007-12-20 00:52:16Z hpdl $
  2. #
  3. # This is used with Apache WebServers
  4. #
  5. # For this to work, you must include the parameter 'Options' to
  6. # the AllowOverride configuration
  7. #
  8. # Example:
  9. #
  10. # <Directory "/usr/local/apache/htdocs">
  11. # AllowOverride Options
  12. # </Directory>
  13. #
  14. # 'All' with also work. (This configuration is in the
  15. # apache/conf/httpd.conf file)
  16.  
  17. # The following makes adjustments to the SSL protocol for Internet
  18. # Explorer browsers
  19.  
  20. #<IfModule mod_setenvif.c>
  21. # <IfDefine SSL>
  22. # SetEnvIf User-Agent ".*MSIE.*" \
  23. # nokeepalive ssl-unclean-shutdown \
  24. # downgrade-1.0 force-response-1.0
  25. # </IfDefine>
  26. #</IfModule>
  27.  
  28. # If Search Engine Friendly URLs do not work, try enabling the
  29. # following Apache configuration parameter
  30.  
  31. # AcceptPathInfo On
  32.  
  33. # Fix certain PHP values
  34. # (commented out by default to prevent errors occuring on certain
  35. # servers)
  36.  
  37. # php_value session.use_trans_sid 0
  38. # php_value register_globals 1
  39.  
  40. Options +FollowSymLinks
  41. RewriteEngine On
  42. RewriteBase /sklep_test/
  43.  
  44. RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING} [L]
  45. RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING} [L]
  46. RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING} [L]
  47. RewriteRule ^(.*)-pi-([0-9]+).html$ popup_add_image.php?pID=$2&%{QUERY_STRING} [L]
  48. RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING} [L]
  49. RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING} [L]
  50. RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING} [L]
  51. RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING} [L]
  52. RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING} [L]
  53. RewriteRule ^(.*)-n-([0-9]+).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING} [L]

No to wchodzi w pętlę...
Mam takie pytanie, bo czytam i czytam o tych wyrażeniach regularnych... dla przykładu zakomentowałem wszystkie reguły poza:
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING} [L]
biorę znaki od początku ciągu do momentu aż natrafię na -c- i potem kolejne znaki do momentu aż natrafię na .html i jeżeli dana reguła będzie pasować to wywołuję stronę index.php?cPath=$2&%{QUERY_STRING} i ponownie wywołuje się plik htacccess, żeby sprawdzić czy przypadkiem ponownie nie będzie pasować jakieś dopasowanie... i dlaczego ponownie dla tego wyrażenia ta reguła pasuje skoro wywołana została strona index.php gdzie nie występuje -c- ani .html?? Bo już sam nie wiem dlaczego to się zapętla...

Ten post edytował adrian1987 29.07.2009, 14:56:17
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 Aktualny czas: 21.08.2025 - 15:50