我为这个看似重复的问题帖子道歉,但我似乎找不到遇到我的具体问题并解决了它的人。This post 很接近,但我做了他们做的一切。
我现在的处境是:
将wp站点迁移到运行ubuntu 18的AWS服务器上的重写模式已启用/home/ubuntu/sites/my-wp-site
"Directory" 具有的节"AllowOverride All"
设置站点的。htaccess文件具有由UI中的permalinks设置设置的重写规则,apache2配置还具有"AllowOverride All"
设置为"Directory"
指向的部分/home/ubuntu/sites
。将永久链接设置为日期和时间后的htaccess内容(否则为空)
BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 5 minutes"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 6 hours"
</IfModule>
<ifModule mod_headers.c>
Header set X-Endurance-Cache-Level "2"
</ifModule>
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/wp-content/endurance-page-cache/ - [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP_COOKIE} !(wordpress_test_cookie|comment_author|wp\\-postpass|wordpress_logg$
RewriteCond %{DOCUMENT_ROOT}/wp-content/endurance-page-cache/$1/_index.html -f
RewriteRule ^(.*)$ /wp-content/endurance-page-cache/$1/_index.html [L]
</IfModule>
<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
亚太地区2。形态...
<Directory /home/ubuntu/sites/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
现场vhost
...
DocumentRoot /home/ubuntu/sites/my-wp-site.com
...
<Directory /home/ubuntu/sites/my-wp-site.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...