Hi,
Hopefully this is a simple one.
I'm about to migrate form Apache to nginx, Ive got everything setup ok, apart form one thing;
In Apache I have a rewrite (in .htaccess) that redirects any request for
http://www.mysite.com/KB/Article/000001.htm
to
http://www.mysite.com/KB/Article/000001
(So it strips the .htm off the end)
It's because the site was originally written in flat html and theres thousands of links going to the old URLs.
How Do I do the same thing in nginx? I'm assuming I add the redirect to my
/etc/nginx/sites-enabled/default
File, as that the one the test site is using;
-=-=-=-=-=-=-=-
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
# Set The Root Directory for the Entire Website
root /var/www/html/;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
# Add The Server IP Address or FQDN
server_name 123.123.123.123;
# The following does the WorkPress Rewrites for the permalinks
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
}
-=-=-=-=-=-=-=-
A) What do I need to add to replicate that Apache/.htaccess redirect.
B) Is there anything you would recommend I add/remove from the above config file.
Thanks in advance
Pete