Redirecting from FC2 homepage to another domain

この記事は約5分で読めます。
スポンサーリンク

Things I want to do

Moved from FC2 HP to a custom domain.

I want to transfer files from each page to the same directory and file.

スポンサーリンク

Redirect using .htaccess

Edit the .htaccess file to configure the transfer. This file should be automatically created in the top-level folder when you create an account on FC2 Homepage.

However, in FC2’s file manager, you cannot edit files by right-clicking, as shown below. (The same applies to the old file manager.)

However, while you cannot edit the file from the file manager, it is not write-protected, and file operations are still possible.

You can update your .htaccess file using the following method.

  • Overwrite via FTP
  • Rename the file to .htaccess.

This time, I’ll show you how to rename a file to .htaccess using only a file manager.

Editing .htaccess

Open the file manager and navigate to the folder where you want to update the .htaccess file. (This can be done with older file managers as well, but we will explain the procedure using the new file manager.)

Make a copy of the .htaccess file to create a backup.

Delete the .htaccess file.

Click the ‘Create File’ icon in the upper left corner of the file manager to create a new file. (You can leave the name as the default newfile.html. Changing the file extension may prevent you from editing the file.)

Right-click the file you created and select ‘Edit in Source’ to edit it.

Once you’ve finished editing, save the file, right-click, select ‘Rename,’ and change the name to .htaccess.

You have now successfully created an .htaccess file with your desired content.

Contents of .htaccess

To redirect from an FC2 homepage to another domain, the .htaccess file should look like this:

Enter your FC2 account as the source. Enter the URL of your new website as the destination. (You will need to change the www.com part to match your new website.)

RewriteEngine On
RewriteCond %{http_host} ^[source].web.fc2.com
RewriteRule ^(.*) https://www.[Destination].com/$1 [R=301,L]

Result

Accessing ‘source.web.fc2.com’ will now redirect you to ‘www.destination.com’.

Also, accessing ‘source.web.fc2.com/sub/’ will redirect you to ‘www.destination.com/sub/’.

Accessing ‘source.web.fc2.com/sub/2.html’ will redirect you to ‘www.destination.com/sub/2.html’.

スポンサーリンク

Other options

Transferring using JavaScript requires embedding it on each page, which is cumbersome. If each page needs to redirect to the destination page, even more code is needed (though you might be able to find a solution).

スポンサーリンク

Websites I used as references

【説明書DL】.htaccessのリダイレクト - 書き方・設置場所・設定方法を解説します
【監修】株式会社ジオコード SEO事業 責任者 栗原 勇一 ある程度長くウェブ担当をされている方、「リダイレクト(転送)」が必要になった経験ってありませんか?転送は普通にHTMLを編集するだけではできなくて、悩まれる方も

コメント

タイトルとURLをコピーしました