htaccess rewrite with Wordpress for translating url slug but don't show in browser bar

时间:2016-03-02 10:52:36

标签: wordpress .htaccess mod-rewrite

I have urls which include slugs that should be displayed in englich. but the cms cannot interprete them right but can the german ones.

  • blah.com/en/team/sprache/french works but is not pretty
  • blah.com/en/team/language/french does not work, but should be in the browser address bar and is quite pretty.

I tried this .htaccess but it does not work - I land on a 404. can anybody explain what goes wrong here:

    # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# special rules for english urls
RewriteRule ^(.*)/language/(.*)$ $1/sprachen/$2

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>

# END WordPress

you need to know that the slugs can occure more then once in the url and there are some other slugs that must be translated as well.

1 个答案:

答案 0 :(得分:1)

内部重写规则不适用于wordpress,因为WP使用index.php作为所有网址的默认前端控制器。