xampp umleitungsschleife

Desperone

Mitglied
Hallo,

ich hab das Problem dass ich lokal immer eine Umleitungsschleife bekomme. Online funktioniert alles super. Habe mod_rewrite an und bei xampp und easyphp getestet. Bei beiden das selbe Problem.

meine .htaccess sieht wie folgt aus
Code:
RewriteEngine on

RewriteRule ^(.*).html$ index.php?path=$1

und die index.php

HTML:
<?php
if($QUERY_STRING == '')
	{
	header('Location: ./Startseite.html');
	}

$body = "if(file_exists('./inc/$path.inc.php'))
	{
	include('./inc/$path.inc.php');
	}
else
	{
	echo '<h1>Fehler 404</h1>
		<p>Die angeforderte URL kann nicht gefunden werden.;
	}";		
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/Strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="de">
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
...
</body>
</html>

Ich finde den Fehler einfach nicht. Wie gesagt online funktioniert alles wunderbar.

die httpd.conf habe ich so eingerichtet wie ich es bei google gefunden habe.

Code:
...

LoadModule rewrite_module modules/mod_rewrite.so

...

ServerName localhost

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/EasyPHP 3.0/www"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride all
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/EasyPHP 3.0/www">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

Ich hoffe jemand von euch erkennt meinen Fehler und kann mir helfen. Danke im Vorraus.
 
Verwende mal $_SERVER['QUERY_STRING'] statt $QUERY_STRING. Außerdem sollte der Location-Headerfeldwert eine absolute URI sein.
 
Super hat geklappt, die Umleitungsschleife ist weg. danke

PHP:
if($_SERVER['QUERY_STRING'] == '')
	{
	header('Location: http://localhost/s/Startseite.html');
	}

so hat es funktioniert. Jetzt hab ich nur noch irgendwo ein Fehler in der Pfadangabe.
Die Startseite und links, die in /inc/ liegen werden noch nicht gefunden.

Vielen Dank


---

Er scheint lokal nicht mit $path zurecht zu kommen. Include funktioniert nur wenn ich ihn ./inc/$path.inc.php angebe. Online funktioniert es wiedermal. Hat vielleicht noch jemand nen Rat?

PHP:
$body = "if(file_exists('./inc/$path.inc.php'))
	{
	include('./inc/$path.inc.php');
	}
else
	{
	echo '<h1>Fehler 404</h1>
		<p>Die angeforderte URL kann nicht gefunden werden.;
	}";
 
Zuletzt bearbeitet:
Zurück