Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem z konfiguracją .htaccess
Forum PHP.pl > Forum > Przedszkole
northwest
Witam serdecznie,
Mam taki plik .htaccess:

  1. Options +FollowSymLinks
  2. RewriteEngine on
  3.  
  4. #Przekierowanie na https
  5. RewriteEngine on
  6. RewriteCond %{HTTP_HOST} ^mojastrona.com [nc]
  7. RewriteRule ^(.*)$ <a href="http://www.mojastrona.com/$1" target="_blank">http://www.mojastrona.com/$1</a> [r=301,nc]
  8.  
  9. #Przekierowanie na https
  10. RewriteEngine On
  11. RewriteCond %{SERVER_PORT} 80
  12. RewriteRule ^(.*)$ <a href="https://www.mojastrona.com" target="_blank">https://www.mojastrona.com</a>
  13.  
  14. <Files .htaccess>
  15. order allow,deny
  16. deny from all
  17. </Files>
  18.  
  19.  
  20. RedirectMatch 403 ^.*/userfiles/(.*).php(.*)$
  21. RedirectMatch 403 ^.*/userfiles/(.*).exe(.*)$
  22. RedirectMatch 403 ^.*/userfiles/(.*).js(.*)$
  23. RedirectMatch 403 ^.*/userfiles/(.*).html(.*)$
  24. RedirectMatch 403 ^.*/userfiles/(.*).php2(.*)$
  25. RedirectMatch 403 ^.*/userfiles/(.*).php3(.*)$
  26. RedirectMatch 403 ^.*/userfiles/(.*).php4(.*)$
  27. RedirectMatch 403 ^.*/userfiles/(.*).php5(.*)$
  28. RedirectMatch 403 ^.*/userfiles/(.*).php6(.*)$
  29. RedirectMatch 403 ^.*/userfiles/(.*).php7(.*)$
  30. RedirectMatch 403 ^.*/userfiles/(.*).phps(.*)$
  31. RewriteRule (.*)\.html index.php?query=$1&lng=$2&%{QUERY_STRING}&modrw [L]



Mam na serwerze Katalog i w nim parę plików html:
https://www.mojastrona.com/banery/strona1.html
https://www.mojastrona.com/banery/strona2.html
https://www.mojastrona.com/banery/strona3.html
https://www.mojastrona.com/banery/strona4.html


Jednak po wywołaniu powyższego adresu w przeglądarce wyświetla mi się strona główna - zamiast tamtego pliku...

Czy mógłby mi ktoś podpowiedzieć co należy poprawić, żeby to zadziałało?
trueblue
Adres: https :// www.mojastrona.com/banery/strona1.html po ostatniej regule, zostanie przepisany na: https :// www.mojastrona.com/index.php?query=banery/strona1&lng=&&modrw
o to Ci chodziło?
northwest
Właśnie nie, chcę żeby po wpisaniu https :// www.mojastrona.com/banery/strona1.html - otworzyło mi faktycznie plik: https :// www.mojastrona.com/banery/strona1.html
A nie stronę główną smile.gif
trueblue
A ostatnia reguła jest potrzebna?
northwest
tak, potrzebuję ją do strony głównej smile.gif
trueblue
To dodaj przed nią regułę:

RewriteCond %{REQUEST_URI} !^/banery/strona(.+).html
northwest
teraz nie przekierowuje na główną - ale też nie wyświetla zawartości tej strony z bannerów sad.gif
Czyli przeglądarka pokazuje poprawny url - ale strona jest widoczna główna
trueblue
Pokaż cały .htaccess po zmianach.
northwest
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3.  
  4. #Przekierowanie na https
  5. RewriteEngine on
  6. RewriteCond %{HTTP_HOST} ^mojastrona.com [nc]
  7. RewriteRule ^(.*)$ <a href="http://www.mojastrona.com/$1" target="_blank">http://www.mojastrona.com/$1</a> [r=301,nc]
  8.  
  9. #Przekierowanie na https
  10. RewriteEngine On
  11. RewriteCond %{SERVER_PORT} 80
  12. RewriteRule ^(.*)$ <a href="https://www.mojastrona.com" target="_blank">https://www.mojastrona.com</a>
  13.  
  14. <Files .htaccess>
  15. order allow,deny
  16. deny from all
  17. </Files>
  18.  
  19.  
  20. RewriteCond %{HTTP_HOST} ^mojastrona.com [nc]
  21. RewriteRule ^(.*)$ <a href="http://www.mojastrona.com/$1" target="_blank">http://www.mojastrona.com/$1</a> [r=301,nc]
  22. RedirectMatch 403 ^.*/userfiles/(.*).php(.*)$
  23. RedirectMatch 403 ^.*/userfiles/(.*).exe(.*)$
  24. RedirectMatch 403 ^.*/userfiles/(.*).js(.*)$
  25. RedirectMatch 403 ^.*/userfiles/(.*).html(.*)$
  26. RedirectMatch 403 ^.*/userfiles/(.*).php2(.*)$
  27. RedirectMatch 403 ^.*/userfiles/(.*).php3(.*)$
  28. RedirectMatch 403 ^.*/userfiles/(.*).php4(.*)$
  29. RedirectMatch 403 ^.*/userfiles/(.*).php5(.*)$
  30. RedirectMatch 403 ^.*/userfiles/(.*).php6(.*)$
  31. RedirectMatch 403 ^.*/userfiles/(.*).php7(.*)$
  32. RedirectMatch 403 ^.*/userfiles/(.*).phps(.*)$
  33. RewriteCond %{REQUEST_URI} !^/banery/strona(.+).html
  34. RewriteRule (.*)\.html index.php?query=$1&lng=$2&%{QUERY_STRING}&modrw [L]
trueblue
.htaccess jest poprawny.
Dla jakiego adresu przekierowuje na główną? Dla jednego z tych 4-ech podanych?
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.