.htacsess リダイレクト サンエツ

サンエツ

この方法で合っているかわからんが、とりあえずリダイレクト設定をした。すでにインデックスされている旧ページで克つ、不要なページは関連する新ページにリダイレクトさせた。茶谷さんがwordpressで作った旧サイトとカートシステムはサーバーからは削除しない事。

/wp
/shop

 

リダイレクト参照ページ

特にこの箇所

ディレクトリ単位のリダイレクト

「old」ディレクトリにアクセスがあった際、「new」ディレクトリに転送をかけたい場合の記述です。

ディレクトリ以下にファイルがある場合は、newでもファイルを置いておかないと404エラーになってしまいます。


RewriteEngine on
RewriteRule ^old(.*)$ /new$1 [L,R=301] 

 

今回の作業のポイント

・httpにアクセスがあってもhttpsにリダイレクト


・茶谷さんが作ったページでインデックスされちゃっているディレクトリを新ページへリダイレクト

・外部サイトのカラミーへのリダイレクト

・茶谷さんが作ったカートシステムの/shop の中にも.htaccessを別個にそれ用として設置
※.htaccessは階層がちがえばたとえ上部階層に.htaccessがあっても同じディレクトリに入っている.htaccessを参照する。

.本当は不要な記述かもしれないけど茶谷さんが作っているwordpressコンテンツに悪さしないようにwordpress関連の.htaccess記述はそのままにする。

編集ファイルは /リダイレクト用/サイトチェンジ後 にある。

ルート直下に.htacess設置↓

AddHandler application/x-httpd-php53 .php

RewriteEngine On

httpsにリダイレクトさせる 。ブリカマはhttpのままだがこの設定でも大丈夫↓
# http->https Redirect 
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Main RewriteRule for multidomain. httpをhttpsと変更させる
RewriteCond %{HTTP_HOST} ^(sanetsu.com)
RewriteCond %{REQUEST_URI} !^/(sanetsu.com)/
RewriteRule ^(.*)$ https://www.sanetsu.com/$1 [L]

# Redirect 各コンテンツのリダイレクト設定

# Redirect
RewriteRule ^gift(.*)$ /goods$1 [L,R=301]
RewriteRule ^showroom(.*)$ /tenpo$1 [L,R=301]
RewriteRule ^contact(.*)$ /inquiry$1 [L,R=301]
RewriteRule ^policy(.*)$ /privacy$1 [L,R=301]
RewriteRule ^goodslabo/scene(.*)$ /index.html$1 [L,R=301]
RewriteRule ^goodslabo(.*)$ /index.html$1 [L,R=301]
RewriteRule ^online(.*)$ https://sanetsu.shop-pro.jp [L,R=301]
RewriteRule ^category/news(.*)$ /sanetsu-information/category/news$1 [L,R=301]
RewriteRule ^category/blog(.*)$ /sanetsu-information/category/blog$1 [L,R=301]
RewriteRule ^category/press(.*)$ /sanetsu-information/category/press$1 [L,R=301]
RewriteRule ^category/giftitem/gift(.*)$ /sanetsu-information/category/giftitem/gift$1 [L,R=301]
RewriteRule ^shop(.*)$ https://sanetsu.shop-pro.jp [R=301,L]
RewriteRule ^goodsitem(.*)$ /index.html$1 [L,R=301]
RewriteRule ^giftitem(.*)$ /index.html$1 [L,R=301]
RewriteRule ^news(.*)$ /sanetsu-information/category/news$1 [L,R=301]

ErrorDocument 404 https://www.sanetsu.com

# Main RewriteRule for multidomain. ブリカマはSSLしないのでそのまま変更なし↓
RewriteCond %{HTTP_HOST} ^(www.burikama.com)
RewriteCond %{REQUEST_URI} !^/(www.burikama.com)/
RewriteRule ^(.*)$ /%{HTTP_HOST}/$1/ [L]

# Main RewriteRule for multidomain.
RewriteCond %{HTTP_HOST} ^(burikama.com)
RewriteCond %{REQUEST_URI} !^/(burikama.com)/
RewriteRule ^(.*)$ http://www.burikama.com/$1 [L]

# 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

 

shop (茶谷さんカート)下に.htaccess設置↓

RewriteEngine On

RewriteRule gift.php$ https://www.sanetsu.com/goods/index.html
RewriteRule ^(.*)$ https://sanetsu.shop-pro.jp/

[R=301,L]

 

 

 

旧ページのいらない物をgoogleインデックスから削除するためにインデックス削除申請。

 

 

 

不要なページをクローラーされないようにrobots.txtをアップ

User-agent:*
Disallow: /giftlabo/
Disallow: /shop/
Disallow: /wp/
Disallow: /giftitem/
Disallow: /goodsitem/