in the Google search data Many people say Nginx does not support. htaccess file, I followed the nginx rule test, the results found Nginx is fully supported. htaccess file!
Here's how:
1. Create a new. htaccess file in the directory where you want to use the. htaccess file,
As one of my Discuz Forum Directory:
Vim/var/www/html/168pc/bbs/.htaccess
2. Enter the rules inside and I'll enter the pseudo-static rules for Discuz:
# nginx rewrite
Wq Save exit.
3. Modify the Nginx configuration file:
vim/etc/nginx/ nginx.conf
4. Introduce the. htaccess file in the server{} that needs to add pseudo-static virtual hosts :
Include/var/www/html/168pc/bbs/.htaccess (change this to the exact location of your. htaccess file)
Wq Save exit.
5. Reload the Nginx configuration file:
/etc/init.d/nginx Reload
Re-open the Web page and see if pseudo-static normal proves that your rewrite rule syntax is correct.
Normal, finished!
add: I found on the internet a can be online Apache rewrite pseudo-static rules are automatically converted to Nginx rewrite Web pages. We can try it.
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/
The contents of this address include the ability to complete the above-mentioned minor modifications. is to automatically convert the rules in. htaccess to the rules available under Nginx.
Summary: the. htaccess file was originally a distributed configuration file for Apache, providing a way to change the configuration for each directory, that is, to place a file containing instructions in a particular directory, where the instructions are applied to this directory and all its subdirectories. In fact, to modify the Nginx can also use the. htaccess file for a variety of functions. Implementing pseudo-Static is just one of the purposes of. Htaccess. Htaccess can also do a lot of purposes, such as filtering access to IP, setting Web Directory access permissions, passwords, and so on.
Linux under Nginx Support. htaccess file implementation Pseudo-static method