You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Barthe Diepstraten <cl...@gmail.com> on 2017/04/21 08:05:40 UTC

[users@httpd] URL rewriting doesn't work on Apache higher than 2.4.20

Hi,

Currently we use the following .htaccess file for URL rewriting which
works fine on Apache 2.4.20. On Apache 2.4.23 and 2.4.25 the URL
rewriting does not work anymore. Instead of the page the following
message appears: File not found.

---
php_value auto_detect_line_endings 1
php_value memory_limit 1024M
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /korting/
    ### Canonicalize codeigniter URLs
    # If your default controller is something other than
    # "welcome" you should probably change this
    RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
    RewriteRule ^(.*)/index/?$ $1 [L,R=301]
    # Removes trailing slashes (prevents SEO duplicate content issues)
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ $1 [L,R=301]
    # Enforce www
    # If you have subdomains, you can add them to
    # the list using the "|" (OR) regex operator
    RewriteCond %{HTTP_HOST} !^(www) [NC]
    RewriteRule ^(.*)$ http://www.domain.nl/korting/$1 [L,R=301]
    # Enforce NO www
    #RewriteCond %{HTTP_HOST} ^www [NC]
    #RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
    ###
    # Removes access to the system folder by users.
    # Additionally this will allow you to create a System.php controller,
    # previously this would not have been possible.
    # 'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /korting/index.php/$1 [L]
    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /korting/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
#Without mod_rewrite, route 404's to the front controller
    ErrorDocument 404 /index.php
</IfModule>
---

This seems like a bug as the .htaccess works perfectly on Apache
2.4.20. We use PHP-FPM.

Please let us know. Thank you in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] URL rewriting doesn't work on Apache higher than 2.4.20

Posted by Eric Covener <co...@gmail.com>.
Maybe PR60576?

On Fri, Apr 21, 2017 at 4:05 AM, Barthe Diepstraten <cl...@gmail.com> wrote:
> Hi,
>
> Currently we use the following .htaccess file for URL rewriting which
> works fine on Apache 2.4.20. On Apache 2.4.23 and 2.4.25 the URL
> rewriting does not work anymore. Instead of the page the following
> message appears: File not found.
>
> ---
> php_value auto_detect_line_endings 1
> php_value memory_limit 1024M
> <IfModule mod_rewrite.c>
>     RewriteEngine On
>     RewriteBase /korting/
>     ### Canonicalize codeigniter URLs
>     # If your default controller is something other than
>     # "welcome" you should probably change this
>     RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
>     RewriteRule ^(.*)/index/?$ $1 [L,R=301]
>     # Removes trailing slashes (prevents SEO duplicate content issues)
>     RewriteCond %{REQUEST_FILENAME} !-d
>     RewriteRule ^(.+)/$ $1 [L,R=301]
>     # Enforce www
>     # If you have subdomains, you can add them to
>     # the list using the "|" (OR) regex operator
>     RewriteCond %{HTTP_HOST} !^(www) [NC]
>     RewriteRule ^(.*)$ http://www.domain.nl/korting/$1 [L,R=301]
>     # Enforce NO www
>     #RewriteCond %{HTTP_HOST} ^www [NC]
>     #RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
>     ###
>     # Removes access to the system folder by users.
>     # Additionally this will allow you to create a System.php controller,
>     # previously this would not have been possible.
>     # 'system' can be replaced if you have renamed your system folder.
>     RewriteCond %{REQUEST_URI} ^system.*
>     RewriteRule ^(.*)$ /korting/index.php/$1 [L]
>     # Checks to see if the user is attempting to access a valid file,
>     # such as an image or css document, if this isn't true it sends the
>     # request to index.php
>     RewriteCond %{REQUEST_FILENAME} !-f
>     RewriteCond %{REQUEST_FILENAME} !-d
>     RewriteRule ^(.*)$ /korting/index.php/$1 [L]
> </IfModule>
> <IfModule !mod_rewrite.c>
> #Without mod_rewrite, route 404's to the front controller
>     ErrorDocument 404 /index.php
> </IfModule>
> ---
>
> This seems like a bug as the .htaccess works perfectly on Apache
> 2.4.20. We use PHP-FPM.
>
> Please let us know. Thank you in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org