I converted some mod_rewrite rules for nginx and they were working fine when I tested it locally but for some reason they are not working on my website.
Can anyone help where I'm going wrong?
Apache rules:
<filesMatch "\.(htm|html|css|js|php)$">
AddDefaultCharset UTF-8
DefaultLanguage en-US
</filesMatch>
<IfModule mod_rewrite.c>
ErrorDocument 404 /404.php
RewriteEngine On
RewriteRule ^article.*$ / [R=301,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*\.* /loadpage.php [QSA,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*\.html /courses/index.php [L]
</IfModule>
Nginx converted rules:
charset utf-8;
error_page 404 /404.php;
location /article {
rewrite ^/article.*$ / redirect;
}
location / {
if (!-e $request_filename){
rewrite ^/.*\.* /loadpage.php break;
}
}
if (!-e $request_filename){
rewrite ^/.*\.html /courses/index.php break;
}