这是.htaccess
文件。
/Library/WebServer/Documents/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mkyong/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mkyong/index.php [L]
</IfModule>
# END WordPress
解
在/etc/apache2/httpd.conf
找到Apache配置文件,确保正确配置了以下设置:
1.加载mod_rewrite.so
。
2.在“ Directory
标签中,将“ AllowOverride
更新为all
(默认为无)
sudo vim /etc/apache2/httpd.conf
# Make sure below module "mod_rewrite.so" is loaded.
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule perl_module libexec/apache2/mod_perl.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
#...
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
#...
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#...
</Directory>
参考文献
翻译自: https://mkyong.com/mac/mac-osx-redirect-htaccess-is-not-working/