admin管理员组

文章数量:1122832

I've a problem with a site (part of a multisite structure).

All of a sudden all the static pages are showing the list with the last posts, except for the homepage. The single posts are working fine.

If I change the permalinks from "post name" to "plain" everything is working fine. here the htaccess file.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]


# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]


what could it be? Any hint? thank you

I've a problem with a site (part of a multisite structure).

All of a sudden all the static pages are showing the list with the last posts, except for the homepage. The single posts are working fine.

If I change the permalinks from "post name" to "plain" everything is working fine. here the htaccess file.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]


# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]


what could it be? Any hint? thank you

Share Improve this question asked Jun 8, 2021 at 19:43 DandeDande 351 silver badge8 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

My use:

    # add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# BEGIN WordPress
# As diretrizes (linhas) entre "BEGIN WordPress" e "END WordPress" são
# geradas dinamicamente e só devem ser modificadas através de filtros do WordPress.
# Quaisquer alterações nas diretivas entre esses marcadores serão sobrescritas.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I know this is an old post but I faced the same problem and did not find the correct answer anywhere. This is not a problem with the .htaccess file or permissions to the folder structure. The problem is moving wordpress sites out of the default document root folder.

If you have multiple wordpress sites or a single site in a sub-folder of your document root folder, you have to "relax access to content" for each sub-folder in the apache2.conf or the httpd.conf files.

When this is added you will be able to use "Pretty Permalinks" instead of the almost pretty or plain permalinks.

/etc/apache2/apache2.conf
/etc/httpd/conf/httpd.conf

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

# Added

<Directory /var/www/html/site1/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

<Directory /var/www/html/site2/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

# End added

本文标签: htaccessOnly plain permalinks working