1

ウェブサイトを古い従来の (m.) url からレスポンシブ デザイン url にリダイレクトしています。

これは、url と htaccess の例です。

Old traditional URL => New Responsive design URL 

m.mydomain.com => mydomain.com
m.mydomain.com/mobiles.html => mydomain.com/mobiles
m.mydomain.com/mobiles/android-phones.html => mydomain.com/mobiles/android-phones-price.html
m.mydomain.com/mobiles/android/samsung-phones.html => mydomain.com/mobiles/samsung/android-phones.html

.htaccess

RedirectMatch 301  m.mydomain.com/mobiles/android/(.*)-phones.html mydomain.com/mobiles/$1/android-phones.html

しかし、 Internal Server Error (500) が発生しています。この問題を修正する方法。

4

1 に答える 1

2

RedirectMatchディレクティブを使用してホスト名を一致させることはできません。mod_rewrite代わりにルールを使用します。

RewriteEngine On

RewriteCond %{HTTP_HOST} ^m\.mydomain\.com$ [NC]
RewriteRule ^$ http://mydomain.com/ [L,R=301]

RewriteCond %{HTTP_HOST} ^m\.mydomain\.com$ [NC]
RewriteRule ^mobiles\.html$ http://mydomain.com/mobiles [L,NC,R=301]

RewriteCond %{HTTP_HOST} ^m\.mydomain\.com$ [NC]
RewriteRule ^mobiles/android-phones\.html$ http://mydomain.com/mobiles/android-phones-price.html [L,NC,R=301]

RewriteCond %{HTTP_HOST} ^m\.mydomain\.com$ [NC]
RewriteRule ^mobiles/android/samsung-phones\.html$ http://mydomain.com/mobiles/samsung/android-phones.html [L,NC,R=301]
于 2014-07-21T14:52:03.307 に答える