我花了一整天的时间试图让我自己的重写在wordpress中运行,但我就是什么都做不到。我尝试了很多不同的方法,但在中什么都没有更新。htaccess文件,所以我不确定我在这一点上做错了什么。例如,我在wordpress手册中找到了这个例子,但它不起作用。https://codex.wordpress.org/Rewrite_API/add_rewrite_rule. 我听说您需要刷新重写,所以我尝试添加flush\\u rewrite\\u rules();功能。php文件,但没有任何区别。此外,我还更新了wordpress永久链接,以获得这样的刷新。但它仍然没有发生任何事情。htaccess文件。那我该怎么办?顺便说一句,我使用的是一个网络酒店服务器主机服务,所以我不能自己更改任何“深层”服务器设置。
我正在使用WP最快缓存插件,它在中显示了很多。htaccess文件。我开始想这是否会干扰,但我认为不会。我真的不知道该怎么做,我真的想让我的链接工作,在那里我有自定义模板,带有$\\u GET[\'\']参数到好看的URL。问题是我只需要它开始工作,就像现在一样,无论我做什么,都不会发生任何事情。最简单的add\\u rewrite\\u规则不会影响任何内容。我敢肯定。htaccess位于站点根文件夹中,我正在编辑正确的功能。php文件。
function custom_rewrite_basic() {
add_rewrite_rule(\'^leaf/([0-9]+)/?\', \'index.php?page_id=$matches[1]\', \'top\');
}
add_action(\'init\', \'custom_rewrite_basic\');
的。htaccess文件(已完全生成,但没有函数重写的痕迹)。
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.mywebsite.com [NC]
RewriteRule ^(.*)$ http\\:\\/\\/mywebsite\\.com\\/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !(\\/){2}$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /storage/content/64/117764/mywebsite.com/public_html/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "\\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
AddType x-font/woff .woff
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
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 application/x-font-ttf
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\\.(?i:ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\\.gz)?$">
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType application/x-javascript A2592000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=2592000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache
# 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
# BEGIN mywebsite
<IfModule mod_headers.c>
<FilesMatch "\\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
#ENDjapgoi