sup*_*ero 6 wordpress multilingual permalinks wordpress-plugin
所以问题基本上是当我使用wpml在网站的翻译版本中使用子类别时,它会生成一个404页面.在父类别中,我仍然可以看到帖子并导航到它没有问题.而且,在没有翻译的版本中一切正常.
所以我的问题是,如果有其他人有这个问题,如果是这样,你是如何解决它的?
/%category%/%postname%/
http://domain.com/en/super/sub/- >http://domain.com/en/sub/# BEGIN Redirects
RedirectMatch 301 ^/okategoriserade/(.*)$ /webb/$1
RedirectMatch 301 ^/apache2/(.*)$ /apache/$1
RedirectMatch 301 ^/server/(.*)$ /linux/$1
RedirectMatch 301 ^/etiketter/(.*)$ /tag/$1
RedirectMatch 301 ^/kategorier/(.*)$ /$1
RedirectMatch 301 ^/en/php-en/zf2/(.*)$ /en/zf2/$1
RedirectMatch 301 ^/media/me-avatar-e1332014347355.png(.*)$ /media/erik-landvall.png$1
RedirectMatch 301 ^/jquery/(.*)$ /javascript/jquery/$1
# END Redirects
# BEGIN W3TC Browser Cache
<IfModule mod_mime.c>
AddType text/css .css
AddType application/x-javascript .js
AddType text/x-component .htc
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType text/xml .xml
AddType video/asf .asf .asx .wax .wmv .wmx
AddType video/avi .avi
AddType image/bmp .bmp
AddType application/java .class
AddType video/divx .divx
AddType application/msword .doc .docx
AddType application/vnd.ms-fontobject .eot
AddType application/x-msdownload .exe
AddType image/gif .gif
AddType application/x-gzip .gz .gzip
AddType image/x-icon .ico
AddType image/jpeg .jpg .jpeg .jpe
AddType application/vnd.ms-access .mdb
AddType audio/midi .mid .midi
AddType video/quicktime .mov .qt
AddType audio/mpeg .mp3 .m4a
AddType video/mp4 .mp4 .m4v
AddType video/mpeg .mpeg .mpg .mpe
AddType application/vnd.ms-project .mpp
AddType application/x-font-otf .otf
AddType application/vnd.oasis.opendocument.database .odb
AddType application/vnd.oasis.opendocument.chart .odc
AddType application/vnd.oasis.opendocument.formula .odf
AddType application/vnd.oasis.opendocument.graphics .odg
AddType application/vnd.oasis.opendocument.presentation .odp
AddType application/vnd.oasis.opendocument.spreadsheet .ods
AddType application/vnd.oasis.opendocument.text .odt
AddType audio/ogg .ogg
AddType application/pdf .pdf
AddType image/png .png
AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
AddType audio/x-realaudio .ra .ram
AddType application/x-shockwave-flash .swf
AddType application/x-tar .tar
AddType image/tiff .tif .tiff
AddType application/x-font-ttf .ttf .ttc
AddType audio/wav .wav
AddType audio/wma .wma
AddType application/vnd.ms-write .wri
AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
AddType application/zip .zip
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A31536000
ExpiresByType application/x-javascript A31536000
ExpiresByType text/x-component A31536000
ExpiresByType text/html A3600
ExpiresByType text/richtext A3600
ExpiresByType image/svg+xml A3600
ExpiresByType text/plain A3600
ExpiresByType text/xsd A3600
ExpiresByType text/xsl A3600
ExpiresByType text/xml A3600
ExpiresByType video/asf A31536000
ExpiresByType video/avi A31536000
ExpiresByType image/bmp A31536000
ExpiresByType application/java A31536000
ExpiresByType video/divx A31536000
ExpiresByType application/msword A31536000
ExpiresByType application/vnd.ms-fontobject A31536000
ExpiresByType application/x-msdownload A31536000
ExpiresByType image/gif A31536000
ExpiresByType application/x-gzip A31536000
ExpiresByType image/x-icon A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType application/vnd.ms-access A31536000
ExpiresByType audio/midi A31536000
ExpiresByType video/quicktime A31536000
ExpiresByType audio/mpeg A31536000
ExpiresByType video/mp4 A31536000
ExpiresByType video/mpeg A31536000
ExpiresByType application/vnd.ms-project A31536000
ExpiresByType application/x-font-otf A31536000
ExpiresByType application/vnd.oasis.opendocument.database A31536000
ExpiresByType application/vnd.oasis.opendocument.chart A31536000
ExpiresByType application/vnd.oasis.opendocument.formula A31536000
ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
ExpiresByType application/vnd.oasis.opendocument.text A31536000
ExpiresByType audio/ogg A31536000
ExpiresByType application/pdf A31536000
ExpiresByType image/png A31536000
ExpiresByType application/vnd.ms-powerpoint A31536000
ExpiresByType audio/x-realaudio A31536000
ExpiresByType image/svg+xml A31536000
ExpiresByType application/x-shockwave-flash A31536000
ExpiresByType application/x-tar A31536000
ExpiresByType image/tiff A31536000
ExpiresByType application/x-font-ttf A31536000
ExpiresByType audio/wav A31536000
ExpiresByType audio/wma A31536000
ExpiresByType application/vnd.ms-write A31536000
ExpiresByType application/vnd.ms-excel A31536000
ExpiresByType application/zip A31536000
</IfModule>
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
</IfModule>
<FilesMatch "\.(css|js|htc|CSS|JS|HTC)$">
<IfModule mod_headers.c>
Header set Pragma "public"
Header append Cache-Control "public, must-revalidate, proxy-revalidate"
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.4"
</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
<IfModule mod_headers.c>
Header set Pragma "public"
Header append Cache-Control "public, must-revalidate, proxy-revalidate"
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.4"
</IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
<IfModule mod_headers.c>
Header set Pragma "public"
Header append Cache-Control "public, must-revalidate, proxy-revalidate"
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.4"
</IfModule>
</FilesMatch>
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 [L]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_HOST} =erik.landvall.se
RewriteCond %{REQUEST_URI} \/$ [OR]
RewriteCond %{REQUEST_URI} (sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?) [NC]
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.php) [NC,OR]
RewriteCond %{REQUEST_URI} (wp-comments-popup\.php|wp-links-opml\.php|wp-locations\.php) [NC]
RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass) [NC]
RewriteCond %{HTTP_USER_AGENT} !(W3\ Total\ Cache/0\.9\.2\.4) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -F
RewriteRule .* "/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core
# 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
DirectoryIndex index.php index.html index.htm
Run Code Online (Sandbox Code Playgroud)
与外部网站问题相关的信息.
我遇到问题的页面以及在我解决问题之前您可以查看的页面.出于用户体验和搜索引擎优化的原因,我已从网页的翻译版本中删除了子类别.
此时翻译还不完整女巫是内容不同的原因.
我在2年前发布了一个关于wplm.org的主题,它完全描述了我的问题.不幸的是,我阅读了激光,但线程结束时没有得到解决.
引自http://wpml.org/forums/topic/error-on-subcategories/
在wordpress中似乎存在子类别的问题.我正在使用wordpress 2.92,当我切换到子类别时,它向我显示404错误页面.但是当我切换回它时,帖子确实出现在主要类别中.这种问题不会出现在主要语言中,只会出现在其他语言中.因此,当我使用主要语言时,帖子显示在子类别和主要类别下,而不是在其他语言中,它们仅出现在主要语言中.
请检查下面的更新。
此问题的解决方案是在您的 Apache 配置中。您需要更改将路径转换为 WordPress 的 index.php 文件的参数的正则表达式。
WordPress 是一个基于 PHP 的非常高级的系统,PHP 本身也是一个非常高级的系统。WordPress 在到达服务器时无法访问 url。它只有index.php 文件,并且需要请求到达该文件,以便它可以处理请求。
为了实现这一点,他们使用 mod_rewrite,这是一个 Apache 模块,它会在服务器决定如何处理请求之前修改请求。
请检查您的服务器的错误日志。您将看到服务器尝试访问的真实文件。另外,请检查.htaccessWordPress 在文件夹中创建的文件。在这些文件中,您将看到 mod_rewrite 使用的正则表达式。
我检查了你的博客,看起来你已经解决了这个问题。我仍然想写下来,以便其他有同样问题的人可以受益。特别是在看到你提到两年前在其他地方的另一篇文章尚未解决之后。
更新:
我很高兴我告诉过“我几乎可以肯定......”:D(指对此答案的评论)看起来事情与我几年前解决的情况有点不同。
我检查了 WordPress 代码并进行了一些尝试。我原本以为 WordPress 找不到这篇文章是因为 /en/,但我错了。WordPress 从 URL 查找帖子的默认行为将这种情况视为一种积极的副作用:假设我没有任何插件或任何语言,因此/en/对 WordPress 来说没有任何意义。
当我想浏览时,erik.landvall.se/en/它按预期返回 404。但是,如果我们有一个类别结构 asabc/cde/efg/和一篇文章 as moo,可以在 访问abc/cde/efg/moo;当我更改链接的类别部分时,WordPress 会自动将我重定向到abc/cde/efg/moo:
en/abc/cde/efg/moo
abc/efg/moo
cde/efg/moo
...
全部重定向到abc/cde/efg/moo. 在你的博客中,我看到了相同的行为,除了 en/ ,它将你的插件带入场景。现在很明显,插件处理 url 结构的方式与 WordPress 最初的方式不同,或者以另一种方式导致原始行为发生变化。
我想像我承诺的那样检查插件源;但我发现现在对我来说这是不可能的,因为这是我必须购买才能看到来源的产品,我不愿意购买我永远不会使用的东西:)
既然您说“在父类别中我仍然可以看到该帖子并毫无问题地导航到它”。我想从网址中删除子类别。这是一个非常肮脏的黑客行为;但比编辑插件更好。
我们将这个丑陋的 php 文件放到fix_lang_subcategory.php我们的根文件夹中:
<?php
function fix_lang_subcategory() {
$p = trim($_SERVER['REDIRECT_URL'], '/');
if (substr_count($p, '/') > 2) {
$_SERVER['REQUEST_URI']='/'.substr($p, 0, strpos($p,'/',4)).'/'.substr($p, strrpos($p, '/')+1).'/'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING'] : '');
}
};
fix_lang_subcategory();
require_once('index.php');
?>
Run Code Online (Sandbox Code Playgroud)
之后,您应该成功地在 /fix_lang_subcategory.php 中看到 WordPress 的 404 文件。如果有效,我们可以编辑 .htaccess 文件。
在 .htaccess 文件的末尾,之后
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
Run Code Online (Sandbox Code Playgroud)
行,我们添加这一行:
RewriteRule ^en/ /fix_lang_subcategory.php [L]
Run Code Online (Sandbox Code Playgroud)
我们在这里所做的是,我们将我们愚蠢的 php 文件的入口点从 wordpress 的 index.php 更改为能够运行几行 php 而无需触及原始源代码。这仅适用于网站的 /en/ 部分。休息就像现在一样。在我们的 php 文件中,我们检查是否看到带有子类别的链接,如果有,我们更改(这不是一件好事!)REQUEST_URI,如下所示:
/en/maincategory/subcategory1/subcategory2/article/?anything_here_untouched
Run Code Online (Sandbox Code Playgroud)
到
/en/maincategory/article/?anything_here_untouched
Run Code Online (Sandbox Code Playgroud)
然后我们让 WordPress 继续正常工作。
如果在启用子类别时插件的工作方式不同,则可能会导致 /en/ 下的子类别页面重定向。
更好的解决方案:
我原以为您不想使用替代语言的子域;但后来我看到“您可以在子目录/子域中托管翻译后的博客版本吗?” 在对您的问题的评论和答复中,似乎提及子目录引起了误解。正如我在 ML 插件的网站上看到的那样,您可以使用子域而不是文件夹,这将为您省去所有麻烦,可能是:
您http://erik.landvall.se/en可以使用http://en.erik.landvall.se/? 或许?
更好的解决方案:
90% 的可能性是 ML 插件导致此问题,他们必须修复它。发起支持票证可能会帮助他们认识到自己的问题并为其他人解决问题。
| 归档时间: |
|
| 查看次数: |
2709 次 |
| 最近记录: |