Joe Bloggs
Joe Bloggs

Reputation: 1462

Wordpress on Nginx server - .htaccess vs. nginx.conf

I have recently changed from Apache to Nginx server and running a Wordpress installation that was migrated onto this new Nginx server.

I only just realised that (the server provider forgot to mention) that the .htaccess file is no longer supported and shouldn't be used with Nginx.

Instead the nginx.conf file should be used. I know I can convert the contents of my current .htaccess file to nginx.conf using one of the convertors, but I don't even have the nginx.conf file.

Can I just create one?? And If I create one, do I place it into the root where currently my .htaccess file is??

Do I then delete the existing .htaccess file?

How should I go about this?

Upvotes: 1

Views: 4371

Answers (1)

KAGG Design
KAGG Design

Reputation: 1945

You definitely have nginx.conf - without it, your site wouldn't work. It is in /etc/nginx/ folder, and some additional configs can exist there and in subfolders.

Standard recommendations for WordPress with nginx you can find here in Codex. But if your site works, you have nothing else to do.

Unlike Apache with .htaccess files, nginx does not use any configuration files in WordPress folders. Everything is centralized in /etc/nginx/.

.htaccess files are ignored by nginx and can be deleted or kept in WordPress folders - it doesn't matter.

However, if you have some non-standard tuning in .htaccess files, you should implement relevant directives in nginx conf files. Convertors not very good for it, and produce errors sometimes, unfortunately. You should learn Apache rules used and create similar for nginx by yourself.

Upvotes: 3

Related Questions