"301 Moved Permanently", Lokal -> Online

Irgendwelche Probleme mit XAMPP für Windows? Dann ist hier genau der richtige Ort um nachzufragen.

"301 Moved Permanently", Lokal -> Online

Postby Iarsin » 14. February 2018 14:01

Hallo,

ich bekomme ein 301 Moved Permanently von der lokalen Seite, danach wird auf die Online-Präsenz umgeleitet.

Code: Select all
$ ping my-joomla-3.8.5-site.local
PING my-joomla-3.8.5-site.local (172.16.240.4): 56 data bytes
64 bytes from 172.16.240.4: icmp_seq=0 ttl=128 time=0 ms
64 bytes from 172.16.240.4: icmp_seq=1 ttl=128 time=0 ms

----my-joomla-3.8.5-site.local PING Statistics----
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip (ms)  min/avg/max/med = 0/0/0/0

$ LANG=C wget --spider http://www.my-joomla-3.8.5-site.local/index.php/de/
Spider mode enabled. Check if remote file exists.
--2018-02-14 13:59:31--  http://www.my-joomla-3.8.5-site.local/index.php/de/
Resolving www.my-joomla-3.8.5-site.local (www.my-joomla-3.8.5-site.local)... 172.16.240.4
Connecting to www.my-joomla-3.8.5-site.local (www.my-joomla-3.8.5-site.local)|172.16.240.4|:80... connected.
HTTP request sent, awaiting response... [b]301 Moved Permanently[/b]
Location: http://www.my-joomla-3.8.5-site.com/index.php/de/ [following]
Spider mode enabled. Check if remote file exists.
--2018-02-14 13:59:31--  http://www.my-joomla-3.8.5-site.com/index.php/de/
Resolving www.my-joomla-3.8.5-site.com (www.my-joomla-3.8.5-site.com)... 217.160.0.248
Connecting to www.my-joomla-3.8.5-site.com (www.my-joomla-3.8.5-site.com)|217.160.0.248|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.


httpd.conf
Code: Select all
Listen 172.16.240.4:80


vhosts.conf
Code: Select all
<VirtualHost *:80>
    ServerAdmin webmaster@my-joomla-3.8.5-site.local
    DocumentRoot "C:/xampp/htdocs/htdocs"
   ServerName www.my-joomla-3.8.5-site.local
   ErrorLog "logs/my-joomla-3.8.5-site.local-error.log"
    CustomLog "logs/my-joomla-3.8.5-site.local-access.log" common
   <Directory "C:/xampp/htdocs/htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *>
    ServerName my-joomla-3.8.5-site.local
    ServerAlias *.my-joomla-3.8.5-site.local
    RedirectMatch permanent (.+)$ http://my-joomla-3.8.5-site.local$1
</VirtualHost>


Code: Select all
egrep -v '^ *$| *#' "C:\xampp\htdocs\htdocs\.htaccess" | grep 301
RewriteRule ^index\.php$ http%2://www.my-joomla-3.8.5-site.local/$1 [R=301,L]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Nobbie » 14. February 2018 18:15

Irgendwo hast Du my-joomla-3.8.5-site.local mit 172.16.240.4 verdrahtet und wenn ich bei mir "ping 172.16.240.4" eingebe, kommt die Fehlermeldung, dass 62.155.244.143 nicht erreichbar ist. Ich habe keine Ahnung, wo und was Du alles konfiguriert hast (DynDNS?!), aber das sind lokale Einstellungen bei Dir und Dir sollten diese IPs etwas sagen. Mir sagen sie nichts. Außer dass es nicht localhost und nicht 127.0.0.1 ist, was ja sinnvoller wäre.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 14. February 2018 18:52

Hallo, das ist ein anderer privater Adressraum, als 192.168.nnn.nnn
https://de.wikipedia.org/wiki/Private_IP-Adresse#Adressbereiche
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 14. February 2018 19:36

Im Verzeichnis eins über dem Webspace der Joomla!-Seite (/htdocs/htdocs), also /htdocs lag /htdocs/.htaccess mit einem redirect:
Code: Select all
Redirect 301 / http://www.my-joomla-3.8.5-site.com/

Diese hatte ich dann umbenannt.

Es ging immer noch nicht, aber wget und w3m zeigten die lokal eingeschalteten debug-Meldungen, bzw. wiesen keinen redirect mehr auf.

Im Verzeichnis eins höher lag ja fälschlicherweise die .htaccess mit dem redirect. Vielleicht hatte sich der Firefox das gemerkt.

Code: Select all
$ wget --spider http://www.my-joomla-3.8.5-site.local/index.php/de/
Spider-Modus eingeschaltet. Es wird geprüft, ob die Datei auf dem Server existiert.
--2018-02-14 17:01:44--  http://www.my-joomla-3.8.5-site.local/index.php/de/
Auflösen des Hostnamens www.my-joomla-3.8.5-site.local (www.my-joomla-3.8.5-site.local). 172.16.240.4
Verbindungsaufbau zu www.my-joomla-3.8.5-site.local (www.my-joomla-3.8.5-site.local)|172.16.240.4|:80 . verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet . 200 OK
Länge: nicht spezifiziert [text/html]
Datei auf dem Server existiert und könnte weitere Verweise enthalten,
aber Rekursion ist abgeschaltet -- kein Download.


Also lag es dann diesmal am Firefox. Chrome hat wohl auch so eine Funktion. Der macht immer noch den redirect. :( EDIT: Bei Chrome hat das Löschen von Cookies und Cache geholfen,.

Um dieses Verhalten im Firefox abzustellen, geht man so vor:

Just to summarize all the steps for people who are less familiar:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box above the list, type or paste access and pause while the list is filtered

(3) TO TURN OFF: If the accessibility.blockautorefresh preference is bolded and "modified" or "user set" to true, double-click it to restore the default value of false

https://support.mozilla.org/de/questions/1191897#question-reply
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Nobbie » 14. February 2018 23:49

??

Firefox kann sich keine .htaccess "merken", das sind Konfigurationsdateien für Apache. Die Browser cachen allenfalls URLs und deren Inhalte.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 15. February 2018 00:51

Der Apache sendet dem Browser ja, aufgrund der vorgefundenen .htaccess, den Fehler 301, und weist ihn an, eine bestimmte Seite aufzurufen.
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Nobbie » 15. February 2018 01:02

301 ist kein Fehler, sondern ein Status. Aber Firefox kennt keine .htaccess, möglicherweise merkt er sich den Location Header und den Status 301.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 15. February 2018 11:03

Ja, das stimmt. Das meinte ich, dass sich der Firefox den redirect Status mit Quelle und Ziel gemerkt hat, vielleicht um das zu beschleunigen?
Habe etwas über die Hintergründe gefunden: http://kb.mozillazine.org/Accessibility.blockautorefresh
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Nobbie » 15. February 2018 14:25

Das ist aber ein behobener Bug, wenn das wirklich bei Dir die Ursache ist/war, müßtest Du einen veralteten Firefox im Einsatz haben?! 9 Jahre alter Bug - ne, ich denke, das hat nichts mit Deiner Problematik zu tun, siehe https://bugzilla.mozilla.org/show_bug.cgi?id=510186
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 15. February 2018 16:55

Nein ich nutze 58.0.4 Quantum. Das hier ist relativ neu, aber beschreibt den umgekehrten Fall (Ich wollte das ja nun unterbinden):
How can I allow selected site to be able to redirect me to other sites, automatically or by warning me, so I can select Allow? As I use the Defense Discount Services site, as I am a veteran. But can't see any of their companies offers, as it redirects me to the company's site I have selected, e.g. Nissan.

I have Firefox Quantum 57.0.1 (64-bit).

Searching on the web, it suggests selecting "Tool", "Options", "Advanced". But I don't see an "Advanced" option.

https://support.mozilla.org/de/questions/1191897#question-reply

Der ursprüngliche Fehler war eine .htaccess Datei, ein Verzeichnis über dem Verzeichnis der Joomla!-Seite, in der wiederum eine unproblematische .htaccess lag) mit dem redirect auf die "Live"-Seite (online, remote), zuvor gab es noch ein Problem mit der hosts-Datei (die catch-all verwies auf 127.0.0.1, die www.domain.com auf 172.16.240.4).

Code: Select all
"C:\xampp\htdocs\.htaccess"           
             Redirect 301 / http://www.my-joomla-3.8.5-site.com/      | webspace(www/root


"C:\xampp\htdocs\htdocs\.htaccess" u.a. 
             RewriteCond %{HTTP_HOST} !^www\. [NC]                    | Joomla!
             RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]  | Joomla!



Veraltete Joomla! 2.5.x .htaccess auf Status 301 untersucht.
Code: Select all
$ egrep -v '^ *$| *#' "C:\xampp\htdocs\htdocs\.htaccess" | grep 301
RewriteRule ^index\.php$ http%2://www.my-joomla-3.8.5-site.local/$1 [R=301,L]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


Nachdem ich die www-.htaccess-Datei aus dem xampp-root umbenannt hatte ging es erst immer noch nicht. Ich musste dann noch in about:config des Firefox und in Chrome die cookies und cache(?) löschen. danach ging es.
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64

Re: "301 Moved Permanently", Lokal -> Online

Postby Nobbie » 15. February 2018 17:08

Lange Rede, kurzer Sinn: alles möglich war Schuld - nur eines nicht, nämlich Xampp.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: "301 Moved Permanently", Lokal -> Online

Postby Iarsin » 15. February 2018 18:38

Wo habe ich das behauptet?
Iarsin
 
Posts: 7
Joined: 05. February 2018 15:57
XAMPP version: 7.1.11
Operating System: Windows 7, x64


Return to XAMPP für Windows

Who is online

Users browsing this forum: No registered users and 27 guests