Centos configuration files are stored in:/etc/httpd/conf/httpd. conf
Open the file and find:
| The code is as follows: |
Copy code |
LoadModule rewrite_module modules/mod_rewrite.so |
Remove the preceding "#". If it does not exist, add the above sentence.
If your website is in the root directory: find
| The code is as follows: |
Copy code |
<Directory/> Options FollowSymLinks AllowOverride None </Directory> |
Change None to All.
If your site is not in the root directory, set as follows:
| The code is as follows: |
Copy code |
<Directory "/var/www/html/my_directory"> Order allow, deny Allow from all AllowOverride All </Directory> |
OK, then restart the server, and the service httpd restart, so that. htaccess can be used.
In my opinion, in CentOs, the method for enabling the rewrite module in Apache is the same as that in windows, but the interface is different.