2016-06-02 3 views
1

私はhtaccessの高度なリダイレクトに助けが必要です。 私は私のブログでいくつかのページを持っているように、htaccessを使って重複するURLをリダイレクト

URL example site.com/en/post-detail/90 

ユーザーはので、私は次のようにすべての要求をリダイレクトするリンク

site.com/en/post-detail/90/(anything after slash) 

によって、同じページにアクセスすることができ

site.com/en/post-detail/90/(anything) to site.com/en/post-detail/90. 

/en/ - is various, it can be Ru, pt, it, fr etc. 
/90/ - is the id of post, so it is always numbers 

答えて

0

してみてください。

RedirectMatch 301 ^/((en|ru|pt|it|fr)/post-detail/([0-9]+))/.+$ /$1 
+0

ちょっと、あなたのコードはうまくいきましたが、ちょっと考えてもらえますか? /を追加すると /en/post-detail/90に私をリダイレクトしますか? –

1

Tr y:

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^site.com/en/post-detail/90/(.*)$ site.com/en/post-detail/90 [R=301,L] 
関連する問題