【问题标题】:RewriteRule doesn´t work with language (404)RewriteRule 不适用于语言 (404)
【发布时间】:2013-10-31 09:58:40
【问题描述】:

我两天以来一直在寻找解决方案,但没有找到解决方案! 我只添加了两个来显示问题,因为我总是得到 404 ...... 如果有人可以帮助我解决这个问题,那就太好了。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^seefracht-spedition\.htm http://www.sats-logistics.com/seefracht-spedition/ [R=301,L,NC]
RewriteRule ^luftfracht-spedition\.htm http://www.sats-logistics.com/luftfracht-spedition/ [R=301,L,NC]
RewriteRule ^service-zollabwicklung\.htm http://www.sats-logistics.com/service-zollabwicklung/ [R=301,L,NC]
RewriteRule ^lager-logistik\.htm http://www.sats-logistics.com/lager-logistik/ [R=301,L,NC]
RewriteRule ^service-hafenabwicklung\.htm http://www.sats-logistics.com/service-hafenabwicklung/ [R=301,L,NC]
RewriteRule ^umzug-spedition\.htm http://www.sats-logistics.com/umzug-spedition/  [R=301,L,NC]
RewriteRule ^kontakt-sats\.htm http://www.sats-logistics.com/kontakt-sats/ [R=301,L,NC]
RewriteRule ^standorte-sats\.htm http://www.sats-logistics.com/standorte-sats/ [R=301,L,NC]
RewriteRule ^downloads\.htm http://www.sats-logistics.com/downloads/ [R=301,L,NC]
RewriteRule ^impressum\.htm http://www.sats-logistics.com/impressum/ [R=301,L,NC]
RewriteRule ^news.php http://www.sats-logistics.com/news/ [R=301,L,NC]
RewriteRule ^links\.htm http://www.sats-logistics.com/links/ [R=301,L,NC]
RewriteRule ^daten/speditionsauftrag-luftfracht.pdf http://www.sats-logistics.com/download/speditionsauftrag-luftfracht.pdf [R=301,L,NC]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
AddHandler x-mapp-php5  .php

# 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

这个网址我也不想添加:

RewriteRule ^en/index\.php http://www.sats-logistics.com/en/ [R=301,L,NC]
RewriteRule ^en/ocean-freight\.htm http://www.sats-logistics.com/en/ocean-freight/ [R=301,L,NC]
RewriteRule ^en/air-freight\.htm http://www.sats-logistics.com/en/air-freight/ [R=301,L,NC]
RewriteRule ^en/custom-brokerage\.htm http://www.sats-logistics.com/en/custom-brokerage/ [R=301,L,NC]
RewriteRule ^en/warehouse-logistics\.htm http://www.sats-logistics.comen/warehouse-logistics/ [R=301,L,NC]
RewriteRule ^en/port-handling\.htm http://www.sats-logistics.com/en/port-handling/ [R=301,L,NC]
RewriteRule ^en/moving-relocation\.htm http://www.sats-logistics.com/en/moving-relocation/ [R=301,L,NC]
RewriteRule ^en/contact\.htm http://www.sats-logistics.com/en/contact/ [R=301,L,NC]
RewriteRule ^en/locations\.htm http://www.sats-logistics.com/en/locations/ [R=301,L,NC]
RewriteRule ^en/downloads\.htm http://www.sats-logistics.com/en/downloads/ [R=301,L,NC]

【问题讨论】:

    标签: wordpress .htaccess mod-rewrite qtranslate


    【解决方案1】:

    I´m searching since two days to find a solution

    你应该早点来 Stackoverflow :P

    更改规则的顺序并删除起始斜线:

    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^luftfracht-spedition\.htm$ http://www.sats-logistics.com/luftfracht-spedition [R=301,L,NC]
    RewriteRule ^en/custom-brokerage\.htm$ http://www.sats-logistics.com/en/custom-brokerage [R=301,L,NC]
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    

    【讨论】:

    • 非常感谢您的快速帮助!!!!!!!!!第一个 RewriteRule 正在工作,但第二个不起作用...这是我添加的代码:RewriteEngine On RewriteBase / RewriteRule ^luftfracht-spedition.htm$ sats-logistics.com/luftfracht-spedition [R=301,L] RewriteRule ^en/custom- brokerage.htm$ sats-logistics.com/en/custom-brokerage [R=301,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule 。 /index.php [L]
    • 其实也可以,我刚输入http://www.sats-logistics.com/en/custom-brokerage.htm,在浏览器中变成了http://www.sats-logistics.com/custom-brokerage/
    • 这就是问题所在!它应该重定向到sats-logistics.com/en/custom-brokerage 以查看英文网站。现在我有英文网址,但有德文内容。
    • 除使用另一种语言 (/en/) 的网站之外的所有重定向现在都可以正常工作! :-) 如果你有其他问题的解决方案就好了!
    • /en/ 文件夹中是否也有 .htaccess?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-09
    • 2018-04-19
    • 1970-01-01
    • 2020-06-29
    • 2021-10-18
    • 2021-04-03
    • 1970-01-01
    相关资源
    最近更新 更多