Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem z konfiguracją .htaccess
northwest
post 27.09.2016, 11:42:06
Post #1





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


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?
Go to the top of the page
+Quote Post
trueblue
post 27.09.2016, 12:01:16
Post #2





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


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?

Ten post edytował trueblue 27.09.2016, 12:01:57


--------------------
Go to the top of the page
+Quote Post
northwest
post 27.09.2016, 12:02:57
Post #3





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


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
Go to the top of the page
+Quote Post
trueblue
post 27.09.2016, 12:03:35
Post #4





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


A ostatnia reguła jest potrzebna?


--------------------
Go to the top of the page
+Quote Post
northwest
post 27.09.2016, 12:11:42
Post #5





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


tak, potrzebuję ją do strony głównej smile.gif
Go to the top of the page
+Quote Post
trueblue
post 27.09.2016, 12:33:38
Post #6





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


To dodaj przed nią regułę:

RewriteCond %{REQUEST_URI} !^/banery/strona(.+).html


--------------------
Go to the top of the page
+Quote Post
northwest
post 27.09.2016, 12:42:19
Post #7





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


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
Go to the top of the page
+Quote Post
trueblue
post 27.09.2016, 12:45:12
Post #8





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


Pokaż cały .htaccess po zmianach.


--------------------
Go to the top of the page
+Quote Post
northwest
post 27.09.2016, 12:55:54
Post #9





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


  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]
Go to the top of the page
+Quote Post
trueblue
post 27.09.2016, 13:32:39
Post #10





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


.htaccess jest poprawny.
Dla jakiego adresu przekierowuje na główną? Dla jednego z tych 4-ech podanych?


--------------------
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: 15.06.2025 - 16:16