Zen777
Zen777

Reputation: 31

Why isn't the RewriteRule working on my Synology NAS hosted website?

Please can anyone tell me why the RewriteRule's aren't working on my website: https://markbanf.synology.me/

If you click the links they show the 404 page. You have to add .php to actually view it.

My .htaccess file is set up as follows:-

ErrorDocument 404 /404.php
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^experience/?$ experience.php
    RewriteRule ^development/?$ development.php
    RewriteRule ^portfolio/?$ portfolio.php

    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

This is a basic HTML and PHP website hosted on a Synology DS216 NAS. Server is Apache/2.4.54.

The exact same files work fine when hosted elsewhere: https://www.markbanf.co.uk/

Upvotes: 1

Views: 1064

Answers (1)

Zen777
Zen777

Reputation: 31

Turns out I needed the following line at the start of my .htaccess file:

AddType application/x-httpd-php .php .html

(This is only necessary as my website is hosted on a NAS.)

Upvotes: 2

Related Questions