🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.www.server-side
5 messages
5 total messages Started by RM Mon, 22 Jun 2020 17:00
302 Found error
#61532
Author: RM
Date: Mon, 22 Jun 2020 17:00
31 lines
1621 bytes
Przy wchodzeniu na moją stronę bez prefiksu www mam taki komunikat:

Found
The document has moved here.
Additionally, a 302 Found error was encountered while trying to use an 
ErrorDocument to handle the request.

Nie rozumiem dlaczego bo nie używam [R] w .htaccess:

#v+
SetEnv CI_ENV testing
DirectoryIndex index.php
ErrorDocument 401 "/home/users/rmagdziarz2018/public_html/praca/denial.html"

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 
!^(index\.php|robots\.txt|denial\.html|resources|captcha|attachments)
RewriteRule ^(.*)$ index.php/$1 [L]

php_value upload_max_filesize 75M
php_value post_max_size 100M
#v-

Proszę o wytłumaczenie.
Re: 302 Found error
#61533
Author: PawelS pawel(at)wbcd(dot)pl
Date: Mon, 22 Jun 2020 17:35
48 lines
2612 bytes
RM pisze:
> Przy wchodzeniu na moją stronę bez prefiksu www mam taki komunikat:
> 
> Found
> The document has moved here.
> Additionally, a 302 Found error was encountered while trying to use an 
> ErrorDocument to handle the request.
> 
> Nie rozumiem dlaczego bo nie używam [R] w .htaccess:
> 
> #v+
> SetEnv CI_ENV testing
> DirectoryIndex index.php
> ErrorDocument 401 
> "/home/users/rmagdziarz2018/public_html/praca/denial.html"
> 
> RewriteEngine on
> RewriteBase /
> 
> RewriteCond %{HTTP_HOST} !^www\.
> RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1
> 
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond $1 
> !^(index\.php|robots\.txt|denial\.html|resources|captcha|attachments)
> RewriteRule ^(.*)$ index.php/$1 [L]
> 
> php_value upload_max_filesize 75M
> php_value post_max_size 100M
> #v-
> 
> Proszę o wytłumaczenie.

A w PHP nie masz jakieś wywołania header("Location: ...") ?
chociaż to byłoby bez sensu, gdyby apache interpretował
nagłówki wygenerowane przez moduł generujący dynamiczną treść.

> The document has moved here.
> Additionally, a 302 Found error was encountered while trying to use an 
> ErrorDocument to handle the request.

Co prawda to będzie trochę dziwne, ale zgaduję,
ze być może brakuje analogicznej do poniższej wspisu:
# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
czyli na wzór powyższego przykładu powinieneś dodać
poniższą konfigurację (oraz upewnić się, że ten plik jest dostępny):
ErrorDocument 302 /error/HTTP_FOUND.html.var
Re: 302 Found error
#61534
Author: RM
Date: Tue, 23 Jun 2020 05:05
15 lines
1417 bytes
Próbuję zrobić możliwość wchodzenia na moją stronę bez prefiksu www.
Zmieniłem
	RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1
na
	RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R]
albo
	RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301]
i nadal mam ten komunikat:

Found
The document has moved here.
Additionally, a 302 Found error was encountered while trying to use an 
ErrorDocument to handle the request.

Rozwiązanie wziąłem z książki więc nie wiem dlaczego nie działa.
Re: 302 Found error
#61535
Author: PawelS pawel(at)wbcd(dot)pl
Date: Wed, 24 Jun 2020 17:22
46 lines
2805 bytes
RM pisze:
> Próbuję zrobić możliwość wchodzenia na moją stronę bez prefiksu www.
> Zmieniłem
>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1
> na
>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R]
> albo
>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301]
> i nadal mam ten komunikat:
> 
> Found
> The document has moved here.
> Additionally, a 302 Found error was encountered while trying to use an 
> ErrorDocument to handle the request.
> 
> Rozwiązanie wziąłem z książki więc nie wiem dlaczego nie działa.

Rozwiązanie z książki działa, ale działa z błędem
(zwracane są nagłówki oraz treść wygenerowana automatycznie):
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 24 Jun 2020 17:14:29 GMT
< Server: Apache
< Location: http://www.www.*****/
< Content-Length: 244
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
< Set-Cookie: SERVERID=s1; path=/
< Cache-control: private
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.www.*****/">here</a>.</p>
</body></html>

OK, rozumiem chcesz przekierować adres bez www na ten z www,
a ja wywołałem ten z www i mam po przekierowaniu 2 razy www.

Być może masz nietypową kompilację apache,
w której nie zostały skompilowane stosowne strony HTML
automatycznie generowane przy takich sytuacjach.
Tak jak wcześniej napisałem, musisz dodać poniższą linię:
ErrorDocument 302 /error/HTTP_FOUND.html.var
oraz upewnić się, że powyższy plik jest osiągalny dla serwera.
Re: 302 Found error
#61536
Author: RM
Date: Thu, 25 Jun 2020 04:12
51 lines
2954 bytes
W dniu 24.06.2020 o 19:22, PawelS pawel(at)wbcd(dot)pl pisze:
> RM pisze:
>> Próbuję zrobić możliwość wchodzenia na moją stronę bez prefiksu www.
>> Zmieniłem
>>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1
>> na
>>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R]
>> albo
>>     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301]
>> i nadal mam ten komunikat:
>>
>> Found
>> The document has moved here.
>> Additionally, a 302 Found error was encountered while trying to use an 
>> ErrorDocument to handle the request.
>>
>> Rozwiązanie wziąłem z książki więc nie wiem dlaczego nie działa.
> 
> Rozwiązanie z książki działa, ale działa z błędem
> (zwracane są nagłówki oraz treść wygenerowana automatycznie):
> < HTTP/1.1 301 Moved Permanently
> < Date: Wed, 24 Jun 2020 17:14:29 GMT
> < Server: Apache
> < Location: http://www.www.*****/
> < Content-Length: 244
> < Connection: close
> < Content-Type: text/html; charset=iso-8859-1
> < Set-Cookie: SERVERID=s1; path=/
> < Cache-control: private
> <
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>301 Moved Permanently</title>
> </head><body>
> <h1>Moved Permanently</h1>
> <p>The document has moved <a href="http://www.www.*****/">here</a>.</p>
> </body></html>
> 
> OK, rozumiem chcesz przekierować adres bez www na ten z www,
> a ja wywołałem ten z www i mam po przekierowaniu 2 razy www.
> 
> Być może masz nietypową kompilację apache,
> w której nie zostały skompilowane stosowne strony HTML
> automatycznie generowane przy takich sytuacjach.
> Tak jak wcześniej napisałem, musisz dodać poniższą linię:
> ErrorDocument 302 /error/HTTP_FOUND.html.var
> oraz upewnić się, że powyższy plik jest osiągalny dla serwera.

Dziękuję za odpowiedz.
Problem rozwiązałem przez odpowiednie ustawienia w panelu klienta 
hostingu. mod_rewrite już niepotrzebny.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads