简体   繁体   中英

.htaccess not working in linux server

Actually my project is in WordPress. I'm changing my server from windows to Linux.

After changing this I'm facing this error!

Why isn't my .htaccess supporting the Linux server?

错误信息

If you're using Apache , you should configure it in order to allow .htaccess files to be executed.

To do so, you can

  • Create a virtual host , that configures specifically one site. Using a virtual host you can set a domain name, document root, server alias, etc. Also, you can set Allowoverride to All (or other). See AllowOverride
  • Set your configuration in /etc/apache2/apache2.conf (or /etc/apache2/httpd.conf in some versions). In these files, there is a <Directory "/var/www/" that points to your /var/www/ directory. Inside this Directory tag, you can set AllowOverride to All . Using this configuration, every site on your server will be allowed to use .htaccess.

I recommend to use the Virtual Host that allows a easier and cleaner configuration.

Checkout the comment in .htaccess file, if it starts with // then change it to #

For me this solved the problem, I wish for you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM