[Apache] error 400 bij mod_rewrite

Pagina: 1
Acties:
  • 671 views sinds 30-01-2008
  • Reageer

  • 2playgames
  • Registratie: Februari 2005
  • Laatst online: 01-06-2025
ik heb een probleem met apache 2.2 en mod_rewrite. ik heb het volgende .htaccess bestand:

code:
1
2
3
RewriteEngine On
#RewriteRule ^(.*)?\.html$ index.php?action=$1 [QSA,L]
RewriteRule ^(.*)?\.htm$ bla.html [L]

(de tweede regel is om te testen, de eerste is wat ik wil bereiken)

als ik nu x.htm opvraag, geeft de server de error 400 (bad request). ik kan niet verklaren waarom dit is. het zit in ieder geval in de server, want ik weet 100% zeker dat de rewriterule ok is. tevens bestaat het bestand bla.html wel en is dit gewoon direct opvraagbaar.
het werkt wel als ik bla.html vervang door /buro/MDD/src/bla.html (dus de absolute url) maar dit wil ik weer net niet hebben

belangrijke informatie: dit is in een alias. dezelfde opstelling werkt wel in de gewone documentroot

de apache logs:

access.log
code:
1
2
3
4
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] "GET /buro/MDD/src/x.htm HTTP/1.1" 400 226
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] "GET /favicon.ico HTTP/1.1" 404 209


error.log
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Starting the Apache2.2 service
The Apache2.2 service is running.
rmine the server's fully qualified domain name, using 10.8.0.2 for ServerName
[Mon Jan 21 21:05:54 2008] [notice] Apache/2.2.8 (Win32) PHP/5.2.5 configured -- resuming normal operations
[Mon Jan 21 21:05:54 2008] [notice] Server built: Jan 18 2008 00:37:19
[Mon Jan 21 21:05:54 2008] [notice] Parent: Created child process 5932
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.8.0.2 for ServerName
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.8.0.2 for ServerName
[Mon Jan 21 21:05:57 2008] [notice] Child 5932: Child process is running
[Mon Jan 21 21:05:57 2008] [notice] Child 5932: Acquired the start mutex.
[Mon Jan 21 21:05:57 2008] [notice] Child 5932: Starting 64 worker threads.
[Mon Jan 21 21:05:57 2008] [notice] Child 5932: Starting thread to listen on port 80.
[Mon Jan 21 21:05:57 2008] [error] [client 127.0.0.1] Invalid URI in request GET /buro/MDD/src/x.htm HTTP/1.1
[Mon Jan 21 21:05:57 2008] [error] [client 127.0.0.1] File does not exist: C:/software/apache/htdocs/favicon.ico
[Mon Jan 21 21:05:57 2008] [error] [client 127.0.0.1] File does not exist: C:/software/apache/htdocs/favicon.ico
[Mon Jan 21 21:05:57 2008] [error] [client 127.0.0.1] File does not exist: C:/software/apache/htdocs/favicon.ico


rewrite.log
code:
1
2
3
4
5
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] [localhost/sid#6f5148][rid#f83300/initial] (3) [perdir D:/School/Buro 302/Workspace/MDD/src/] strip per-dir prefix: D:/School/Buro 302/Workspace/MDD/src/x.htm -> x.htm
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] [localhost/sid#6f5148][rid#f83300/initial] (3) [perdir D:/School/Buro 302/Workspace/MDD/src/] applying pattern '^(.*)?\.htm$' to uri 'x.htm'
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] [localhost/sid#6f5148][rid#f83300/initial] (2) [perdir D:/School/Buro 302/Workspace/MDD/src/] rewrite 'x.htm' -> 'bla.html'
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] [localhost/sid#6f5148][rid#f83300/initial] (3) [perdir D:/School/Buro 302/Workspace/MDD/src/] add per-dir prefix: bla.html -> D:/School/Buro 302/Workspace/MDD/src/bla.html
127.0.0.1 - - [21/Jan/2008:21:05:57 +0100] [localhost/sid#6f5148][rid#f83300/initial] (1) [perdir D:/School/Buro 302/Workspace/MDD/src/] internal redirect with D:/School/Buro 302/Workspace/MDD/src/bla.html [INTERNAL REDIRECT]


ik hoop dat ik zo voldoende informatie heb gegeven om een oplossing te kunnen vinden.

ps. het staat weliswaar in de "D:\School" map, maar het is voor het werk. ik weet dat hier op T.net huiswerkvragen vaak niet gewaardeerd worden :P

[ Voor 4% gewijzigd door 2playgames op 21-01-2008 21:54 ]


  • _H_G_
  • Registratie: September 2002
  • Laatst online: 12:44
Nooit meer gewerkt, maar als je (simpel gezegd)
(willekeurige reeks).htm
vervangt door
bla.htm

Dan krijg je die willekeurige reeks dus nooit terug. Of zie ik dat verkeerd?

[ Voor 19% gewijzigd door _H_G_ op 22-01-2008 07:37 ]


  • frickY
  • Registratie: Juli 2001
  • Laatst online: 16:32
Aangezien je een alias gebruikt zou het gebruik van RewriteBase je moeten helpen.

  • 2playgames
  • Registratie: Februari 2005
  • Laatst online: 01-06-2025
RewriteBase was inderdaad de oplossing. Helaas kan ik die niet in httpd.conf opnemen maar moet hij echt in .htaccess, wat weer inhoudt dat dat bestand bij elke installatie aangepast moet worden.
Daar moet ik dan maar mee leven :|