problem with an .htaccess file; leads to persistent fault

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem with an .htaccess file; leads to persistent fault

Postby OneUseAccount » 10. July 2016 00:08

Hello,
I believe to have narrowed down an bug I have found to the following.

Scenario:
1. Step: I have a virtual host ("my.lo", correctly set in the "C:\xampp\apache\conf\extra\httpd-vhosts.conf" file and set to 127.0.0.1 in the "hosts" file in "C:\Windows\System32\drivers\etc"). In the root directory for the virtual host ("my") I have a file called "temp .htaccess".
Starting apache in the xammp control panel I can call http://my.lo in my Firefox browser.
Stopping apache then.
2. Step: Having the file "temp .htaccess" renamed to ".htaccess", starting apache again and trying to call "my.lo" in my browser the browser shows the standard error message "Fehler: Server nicht gefunden" (Error: Server was not found"). It tries to load for some time when first trying to call it. Later calls nearly immeaditly show the error message in the browser.
Stopping apache.
3. Step: Changing back the name to "temp .htaccess". Starting apache. Trying to call "my.lo" in the browser still show the error message now.

Clearing browser cache and its local-storage is no help.

The ".htaccess" file is: (10 lines, first line has a single space and then \r\n, 7th line is empty and has only \r\n, 10th line is empty.)
Code: Select all
 
RewriteEngine On
#Options FollowSymLinks
ErrorDocument 404 default
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

ErrorDocument 404 default
# ErrorDocument 404 /neuanlegen.php?aktion=DateiNichtVorhanden


Is it because of the .htaccess content? Or a bug in that xammp/apache version?
I know for sure that in former versions I had .htaccess files in the virtual host's root directory.
Is it a known bug?

[EDIT by Altrea: moved to the english section]
OneUseAccount
 
Posts: 3
Joined: 09. July 2016 23:51
XAMPP version: 5.6.3
Operating System: Win 7

Re: problem with an .htaccess file; leads to persistent faul

Postby Nobbie » 10. July 2016 13:49

OneUseAccount wrote:Is it because of the .htaccess content?


Yes, of course. The RewriteRule redirects to http://www.my.lo (if all your applied information is coorect) which seems to be unknown.

OneUseAccount wrote:Clearing browser cache and its local-storage is no help.


Because this usually does not force a refresh, press Shift+F5 and try again. Anyway, it is a bad a idea to call a file "temp .htaccess", maybe Apache falls over it. I would not do so.
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04

Re: problem with an .htaccess file; leads to persistent faul

Postby OneUseAccount » 10. July 2016 14:01

Two mistakes:
1. In the windows "hosts" file there was no entry for the version with "www": "www.my.lo".
2. The browser seems to remember the 301-message from the server. So when renaming the .htaccess file on the server so it is not used anymore, the browser still by itself tries to get the "www." version of the domain, even when I only entered "my.lo".
It is Firefox 41.0.1. Maybe in the browser "Webseiten-Einstellungen löschen" (delete website-settings) would have helped to remove the 301-directive in the browser cache, but I didn't try this as it would have deleted the settings for all websites, being there no user interface to delete the settings on per-site basis.
OneUseAccount
 
Posts: 3
Joined: 09. July 2016 23:51
XAMPP version: 5.6.3
Operating System: Win 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 154 guests