mod_rewrite path info postfix und per-dir-Präfix

1044
Alexey Kosov

Es gibt ein Problem mit der .htaccess-Konfiguration.

Ich brauche nur die URL / category, um mit dem category.php- Skript übereinzustimmen, aber wenn ich versuche, diese URL zu öffnen, gibt es stattdessen einen 404-Fehler.

Hier ist mein Zugang.

RewriteEngine on RewriteRule ^category/ category.php [QSA,L] 

htaccess log:

init rewrite engine with requested uri /category/ [www.test.com/sid#7fc1c2694dd0][rid#7fc1c25f00a0/initial] pass through /category/ [www.test.com/sid#7fc1c2694dd0][rid#7fc1c25e80a0/subreq] [perdir /home/ubuntu/domains/test.com/public_html/] add path info postfix: /home/ubuntu/domains/test.com/public_html/category.php -> /home/ubuntu/domains/test.com/public_html/category.php/ [www.test.com/sid#7fc1c2694dd0][rid#7fc1c25e80a0/subreq] [perdir /home/ubuntu/domains/test.com/public_html/] strip per-dir prefix: /home/ubuntu/domains/test.com/public_html/category.php/ -> category.php/ [www.test.com/sid#7fc1c2694dd0][rid#7fc1c25e80a0/subreq] [perdir /home/ubuntu/domains/test.com/public_html/] applying pattern '^category/' to uri 'category.php/' [www.test.com/sid#7fc1c2694dd0][rid#7fc1c25e80a0/subreq] [perdir /home/ubuntu/domains/test.com/public_html/] pass through /home/ubuntu/domains/test.com/public_html/category.php 

Und das Ergebnis ist ein 404-Fehler von Apache: Nicht gefunden

Die angeforderte URL / Kategorie / wurde auf diesem Server nicht gefunden.

Wenn ich /category.php direkt öffne, funktioniert es.

Hier ist die vhost config:

<VirtualHost *:80> ServerName test.com ServerAlias www.test.com  ServerRoot /home/ubuntu/domains/test.com DocumentRoot public_html <Directory "/home/ubuntu/domains"> Options FollowSymLinks MultiViews AllowOverride all Require all granted </Directory>  RewriteEngine On LogLevel alert rewrite:trace3  ErrorLog logs/error.log CustomLog logs/access.log combined  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json DeflateCompressionLevel 9 </VirtualHost> 

Serverversion: Apache / 2.4.7 (Ubuntu)

Server gebaut: 22 Jul 2014 14:36:38

1

1 Antwort auf die Frage

1
knb

Ich hatte ein ähnliches Problem und ersetzte

Options MultiViews 

mit

Options -MultiViews 

Eigentlich bin ich damit fertig geworden

Options +Indexes +FollowSymLinks -MultiViews 

Ich habe diese Lösung hier gefunden:

https://velenux.wordpress.com/2012/07/17/apache-mod_rewrite-multiple-add-path-info-postfix/