wordpress - 在 WordPress 中如何将 root/wp-content 或 root/wp-content/plugin 目录 url 重定向到主页

标签 wordpress .htaccess

我如何将 root/wp-content 重定向到 WordPress 中的主索引页面我已经安装了重定向插件并定义了它们的 http://www.heraldsolutions.in/wp-content/http://www.heraldsolutions.in/但它的重定向不起作用,我们也维护了 .htaccess 应用规则,但它没有在 hompage 上重定向。请帮助解决此问题

.htaccess 文件代码:

<files wp-config.php>
order allow,deny
deny from all
</files>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-content(/.*)?$ / [L,R,NC]
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^[a-z0-9]{1,4}[.](htm|pdf|jar) default.php [L]
</IfModule>

# 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
# Redirect /home http://heraldsolutions.in
Redirect /home /index.php
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
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

# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>

最佳答案

将此规则插入 WP .htaccess 中任何其他重写规则之前(位于 RewriteBase 行下方):

RewriteRule ^wp-content(/.*)?$ / [L,R,NC]

关于wordpress - 在 WordPress 中如何将 root/wp-content 或 root/wp-content/plugin 目录 url 重定向到主页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19243645/

相关文章:

jquery - 从 WordPress 中获取特定类别的帖子内容并显示在网页上

css - 找不到主题 css

wordpress - wp_remote_post 在 SSL 连接上返回错误

apache - vue项目中如何将所有www流量重定向到非www网址

php - 将mysql结果放在一个数组中

css - Wordpress 发布图像(详细信息)默认类

apache - 使用 https 将域重定向到另一个域时出错

.htaccess - 无法一点一点地验证域

php - 设置php_flag error_reporting不起作用

.htaccess - 如何使用 ssl 在 joomla 站点中从非 www 重定向到 www