Saya mencoba mengaktifkan mod_rewrite di instance Amazon Linux. Arahan Direktori saya terlihat seperti ini:
<Directory />
Order deny,allow
Allow from all
Options None
AllowOverride None
</Directory>
<Directory "/var/www/vhosts">
Order allow,deny
Allow from all
Options None
AllowOverride All
</Directory>
Dan kemudian lebih jauh ke bawah di httpd.conf saya punya LoadModulearahan:
... other modules...
#LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule proxy_module modules/mod_proxy.so
... other modules...
Saya telah berkomentar semua modul Apache tidak diperlukan oleh Wordpress.
Masih ketika saya mengeluarkan http restart dan kemudian memeriksa modul yang dimuat dengan /usr/sbin/httpd -lsaya hanya mendapatkan:
[root@foobar]# /usr/sbin/httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
Di dalam virtual host yang berisi situs Wordpress saya punya yang .htaccessberisi:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
.Htaccess dimiliki oleh apache yang dijalankan oleh apache pengguna. The apachectl -tperintah kembaliSyntax OK
/etc/httpd/conf.d/vhosts.confPenampilan saya seperti ini:
<VirtualHost *:80>
ServerAdmin foobar@gmail.com
ServerName foobar.net
ServerAlias www.foobar.net
DocumentRoot /var/www/vhosts/foobar/
ErrorLog /var/www/vhosts/foobar/logs/error.log
CustomLog /var/www/vhosts/foobar/logs/access.log combined
</VirtualHost>
Apa yang saya lakukan salah? Apa yang harus saya periksa?