admin管理员组文章数量:1321606
I apologize for the seemingly duplicate issue posting but I can't seem to find someone who has come across my specific issue and resolved it. This post got close but I did everything they did.
here's where I'm at:
- migrated a wp site to an AWS server running ubuntu 18
- rewrite mod is enabled
- site is in
/home/ubuntu/sites/my-wp-site
- site dir is owned by www-data
- site's virtual hosts file has the necessary
"Directory"
section with"AllowOverride All"
set - site's .htaccess file has the rewrite rules set by the permalinks settings in the UI
- apache2 config also has the
"AllowOverride All"
set for a"Directory"
section pointed at/home/ubuntu/sites
What am I missing?
.htaccess
contents after setting the permalinks to date and time (empty otherwise)
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
apache2.conf
...
<Directory /home/ubuntu/sites/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
vhost for site
...
DocumentRoot /home/ubuntu/sites/my-wp-site
...
<Directory /home/ubuntu/sites/my-wp-site>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
I apologize for the seemingly duplicate issue posting but I can't seem to find someone who has come across my specific issue and resolved it. This post got close but I did everything they did.
here's where I'm at:
- migrated a wp site to an AWS server running ubuntu 18
- rewrite mod is enabled
- site is in
/home/ubuntu/sites/my-wp-site
- site dir is owned by www-data
- site's virtual hosts file has the necessary
"Directory"
section with"AllowOverride All"
set - site's .htaccess file has the rewrite rules set by the permalinks settings in the UI
- apache2 config also has the
"AllowOverride All"
set for a"Directory"
section pointed at/home/ubuntu/sites
What am I missing?
.htaccess
contents after setting the permalinks to date and time (empty otherwise)
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
apache2.conf
...
<Directory /home/ubuntu/sites/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
vhost for site
...
DocumentRoot /home/ubuntu/sites/my-wp-site
...
<Directory /home/ubuntu/sites/my-wp-site>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
Share
Improve this question
edited Sep 21, 2020 at 15:31
fischgeek
asked Sep 21, 2020 at 1:39
fischgeekfischgeek
1214 bronze badges
7
|
Show 2 more comments
1 Answer
Reset to default 1Since the domain/site has an ssl, the vhosts file for the ssl is separate and also needs to be updated. Not just the normal port 80 entry.
vhost (:80)
my-wp-site.conf
<VirtualHost *:80>
...
DocumentRoot /home/ubuntu/sites/my-wp-site
...
<Directory /home/ubuntu/sites/my-wp-site>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
</VirtualHost>
vhost (:443)
my-wp-site-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
...
ServerName my-wp-site
ServerAlias my-wp-site
DocumentRoot /home/ubuntu/sites/my-wp-site
<Directory /home/ubuntu/sites/my-wp-site>
Options None FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
</VirtualHost>
</IfModule>
本文标签: apacheWordPress Permalinks still not working despite all necessary settings
版权声明:本文标题:apache - WordPress Permalinks still not working despite all necessary settings 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742105449a2420997.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
DocumentRoot
? When you say the vHost has the necessaryDirectory
section, can you confirm the file system path this is set for. Please include the contents of your .htaccess file and where exactly this is located. If you add some nonsense to your .htaccess file, does it “break”? – MrWhite Commented Sep 21, 2020 at 10:06|wordpress_logg$
- which implies either mod_rewrite is not enabled or.htaccess
overrides are not enabled (otherwise you'd be getting a 500 response). – MrWhite Commented Sep 21, 2020 at 13:03DocumentRoot
is set to/home/ubuntu/sites
, but are accessing your site asexample/my-wp-site/
then the "front page" would render correctly but permalinks would not. However, the "syntax error" I mentioned above is a show-stopper and suggests your vHost/server config is indeed misconfigured (as stated). – MrWhite Commented Sep 21, 2020 at 15:03