Enable. htaccess in centOS (Remove php suffix access)
My requirement is: Change api/x. PHP to api/x for access. I tried to find a lot of information on the Internet and I agree with the following statement.
Prepare the. htaccess file as follows:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^ (. *) $ X. php [E = PATH_INFO: $1, QSA, PT, L]
</IfModule>
1. Edit the httpd. conf file
A-in the httpd. conf file in the etc/httpd/conf/directory, find:
LoadModule rewrite_module modules/mod_rewrite.so
If there is # above, cancel it. If not, do not modify it by default. (But I noted it later and it will take effect again)
B-set AllowOverride
Find the following script in httpd. conf.
<Directory/>
Options FollowSymLinks
AllowOverrideNone
</Directory>
Change None to All (I changed AllowOverrideNone in the directory where the project is located)
2. Restart the Apache Environment
Systemctl restart httpd