我有一个WordPress页面,其主页重定向到子目录中的 index.html 。除博客搜索外,其他一切正常。
这是在Wordpress上构建的页面,但我必须修改 .htaccess 才能显示为驻留在其根子目录/sp-html
中的主页。当用户想要转到另一个页面或博客时,他被移至WordPress站点,该站点是该域的主要站点。一切正常,但现在我发现博客文章搜索将重定向到我的html主页,而不是显示搜索结果。这是我的 .htaccess 文件:
Options -Indexes
RewriteEngine On
RewriteRule ^home sp-html/index.html [NC,L]
RewriteRule ^/?$ sp-html/index.html [NC,L]
RewriteCond %{REQUEST_URI} !^/wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wordpress/$1
RewriteEngine on
Rewritecond %{HTTP_HOST} ^(www.)?blog.example.com$
Rewriterule ^(.*) https://example.com/news-ideas [QSA,L,R=301]
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType image/svg+xml "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
ExpiresByType application/javascript "access plus 30 days"
ExpiresByType application/x-javascript "access plus 30 days"
ExpiresByType text/xml "access plus 60 minutes"
</IfModule>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
我应该如何修改.htaccess才能使博客搜索引擎正常工作?我认为问题出在这一行:
RewriteRule ^/?s=$ /wordpress/$1 [NC,L]
bu它是使重定向工作所必需的,而且我认为也重定向搜索查询。
有谁知道如何修复它?