2

There's an issue with .htaccess configuration.

I just need the url /category to match the category.php script, but when I try to open this url, there's a 404 error instead.

Here's my .htaccess:

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

And the result is 404 error by Apache: Not Found

The requested URL /category/ was not found on this server.

If I open /category.php directly, it works.

Here's the 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>

Server version: Apache/2.4.7 (Ubuntu)

Server built: Jul 22 2014 14:36:38

1 Answers1

2

I had a similar problem and replaced

Options MultiViews

with

Options  -MultiViews

Actually I ended up with

Options +Indexes +FollowSymLinks -MultiViews

I found that solution here:

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

knb
  • 165