

URL間違いに伴い、下記のように301リダイレクトを設置しました。  
しかし、リダイレクト先が絶対パスになってしまいうまくアクセスできません。

# コードの記述

[code]

    RewriteEngine On
    RewriteRule ^gallery/design/bellipaint-design-([0-9]{3})/$ 
    gallery/design/bellypaint-design-$1/ [R=301,L]
    
[/code]

# リダイレクトされた結果

<https://www.heartkoru.com/home/heartkoru/heartkoru.com/public_html/gallery/design/bellypaint-
design-001/>

本来は下記のようにならなければなりません。  
<https://www.heartkoru.com/gallery/design/bellypaint-design-001/>

解決方法をご存知の方がいらっしゃいましたら、ご教授いただけますと大変助かります。

なお、全記述は下記の通りです。

* * *
[code]

    Options +FollowSymLinks
    AddDefaultCharset utf-8
    
    #www有りに正規化
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(heartkoru\.com)(:80)? [NC]
    RewriteRule ^(.*) https://www.heartkoru.com/$1 [R=301,L]
    
    #index.htmlなしに正規化
    RewriteEngine on
    RewriteCond %{THE_REQUEST} ^.*/index.html
    RewriteRule ^(.*)index.html$ https://www.heartkoru.com/$1 [R=301,L]
    
    #SSLリダイレクト
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    #404ページへの誘導
    ErrorDocument 404 /404.html
    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} lightbox=
    RewriteRule ^/gallery/? [R=301,L]
    
    RewriteEngine On
    RewriteRule ^gallery/design/bellipaint-design-([0-9]{3})/$ gallery/design/bellypaint-design-$1/ [R=301,L]
    
    #ページ単位の301
    Redirect permanent /princess https://www.heartkoru.com/bellypaint-menu/princess/
    Redirect permanent /babyphoto-1 https://www.heartkoru.com/mother/baby-photo/
    Redirect permanent /maternitypaint-design?lightbox=image_1ssd https://www.heartkoru.com/gallery/
    Redirect permanent /maternity-photo https://www.heartkoru.com/bellypaint-menu/maternity-photo/
    Redirect permanent /bellypaint https://www.heartkoru.com/bellypaint-menu/
    Redirect permanent /maternitypaint-design https://www.heartkoru.com/gallery/
    Redirect permanent /aboutus https://www.heartkoru.com/about/
    Redirect permanent /babyphoto https://www.heartkoru.com/mother/breastfeeding/
    Redirect permanent /bellypaint-memo https://www.heartkoru.com/about/
    Redirect permanent /blank https://www.heartkoru.com/copyright/
    Redirect permanent /blank-1 https://www.heartkoru.com/gift/
    Redirect permanent /maori https://www.heartkoru.com/bellypaint-menu/maori/
    Redirect permanent /staff https://www.heartkoru.com/about/
    Redirect permanent /menu3 https://www.heartkoru.com/faq/
    Redirect permanent /menu1 https://www.heartkoru.com/about/
    Redirect permanent /company https://www.heartkoru.com/about/
    Redirect permanent /staff-1 https://www.heartkoru.com/about/
    Redirect permanent /maternitypaint-design https://www.heartkoru.com/gallery/
    Redirect permanent /petit-flower https://www.heartkoru.com/bellypaint-menu/petit-flower/
    Redirect permanent /originalgoods https://www.heartkoru.com/gift/
    Redirect permanent /trial https://www.heartkoru.com/bellypaint-menu/trial/
    Redirect permanent /decoart https://www.heartkoru.com/bellypaint-menu/
    Redirect permanent /#!bellypaint-menu/ https://www.heartkoru.com/bellypaint-menu/
    Redirect permanent /gallery/?lightbox=dataItem-j2qspwgr https://www.heartkoru.com/gallery/
    Redirect permanent /gallery/?lightbox=dataItem-it14z4i8 https://www.heartkoru.com/gallery/
    
    #gzip圧縮
    <IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|ico)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI _\.utxt$ no-gzip
    #DeflateCompressionLevel 4
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    </IfModule>
    SetEnvIf Request_URI ".*" AllowCountry
    
[/code]


CC BY-SA 4.0
2018-06-29T07:07:46.040
45149
2020-01-30T07:02:55.403
2020-06-17T08:14:45.997
-1
28924
question
.htaccess
リダイレクト設定すると絶対パスが表示されてしまいます。


`RewriteBase /` を追加してみてください。

[code]

    Options +FollowSymLinks
    AddDefaultCharset utf-8
    
    #www有りに正規化
    RewriteEngine on
    RewriteBase /  <- 追加
     ：：：
    
[/code]


CC BY-SA 4.0
2018-06-29T07:43:00.330
45153
2018-06-29T07:43:00.330
5008
45149
answer