javaee论坛

普通会员

225648

帖子

328

回复

342

积分

楼主
发表于 2017-08-11 17:50:30 | 查看: 16209 | 回复: 0

Method 1 of 6: Prepare the New Domain and Files

  1. 1
    Make sure the new domain is directed to your hosted account.
    Ad
  2. 2
    Download the files from the old domain to your local computer. Keep the same directory structure and file names.
  3. 3
    Upload the files from the old domain to the new domain.
  4. 4
    Click the start button and choose “Accessories” and “Notepad” to open a text editor.

Method 2 of 6: Use a META Command to Redirect the URL

  1. 1
    Open the “index.html” or the file that you want to redirect.
  2. 2
    Position the cursor after the HEAD tag in the code.
  3. 3
    Type in the following:
    • <meta http-equiv="refresh" content="0; URL=http://www.newsite.com/newurl.html">
    • "0" here stands for number of seconds before redirect happens. The www.newsite.com/newurl.html line is the website and the specific webpage that the page is to be redirected to.
  4. 4
    Add text to create a custom error page, if desired. Include an announcement that the site has moved. Add the new site name, with a link that can be clicked manually. Change the refresh time so that it allows the reader enough time to read the message.
  5. 5
    Save the file.

Method 3 of 6: Use an htaccess File

  1. 1
    Find out if your website is running on an Apache server. The htaccess file on an Apache web server handles error requests, redirection and other requests.
  2. 2
    Understand 300 http codes. The code "301" is most commonly used on redirected sites, and means "moved permanently".
  3. 3
    Type or paste the following code into the text file:
    • RewriteEngine On
      RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
    • “L” indicates that it’s the last instruction and “R” means redirect, and “301” means a permanent redirect.
  4. 4
    Learn how to redirect a url with spaces in the name, dynamic pages, sub-domains and other special features by searching online.[1]
  5. 5
    Change “newdomain.com” to the actual domain name.
  6. 6
    Click “save.” Change the dropdown list to “all files.” Save the file as .htaccess with no extension.

Method 4 of 6: Upload and Test the File

  1. 1
    Rename any existing .htaccess files or html files with the same name to keep a backup copy. Use .htaccessbackup or something similar so that you can find and recognize the file if you need to do a restore.
  2. 2
    Upload the modified file to the root directory of the old domain.
  3. 3
    Type the old domain name in your web browser. It should redirect to the new site.

Method 5 of 6: Use a Service

  1. 1
    Various URL redirection services are available to handle the technical bits for you. Depending on your needs, these services may be free or have a small fee associated with their use.
    • Usually you just need to edit a DNS record for a domain name you own.

Method 6 of 6: Use Other Code

  1. 1
    Find out what code your site is written in. There are different commands for each type of code.
    • You can find code for PHP, ASP, ColdFusion and Javascript redirects online.[2]
    Ad

We could really use your help!

Can you tell us about
sweat control?
Yes
No
Can you tell us about
school hacks?
Yes
No
Can you tell us about
Adobe Photoshop?
Yes
No
Can you tell us about
mind hacks?
Yes
No

Warnings

  • Pages with meta refresh are often filtered by search engines since it’s a known spam technique.
  • FrontPage users will need to modify .htaccess files in _vti_bin and the _vti_bin subfolders _vti_adm and _vti_aut.

Related wikiHows

How to 
Block Page Redirects

How to 
Get a YouTube Custom URL

How to 
Add a Website Link to the Start Menu

How to 
Create Small URL Links

How to 
Send Long URLs Over Email

How to 
Create a Free Redirect Domain with DynDNS

How to 
Delete a Redirect on wikiHow

Article Info

Categories: Website Maintenance

In other languages:

Español: Cómo redireccionar un URL, Português: Como Redirecionar um URL, Italiano: Come Reindirizzare un URL, Русский: перенаправить URL

Thanks to all authors for creating a page that has been read 543,749 times.

Did this article help you?

您需要登录后才可以回帖 登录 | 立即注册

触屏版| 电脑版

技术支持 历史网 V2.0 © 2016-2017