How to Forward URLs

Author: Monica Porter
Date Of Creation: 15 March 2021
Update Date: 1 July 2024
Anonim
Domain Name Forwarding - How To Redirect One Domain to Another Domain - Simple Steps + One Caveat
Video: Domain Name Forwarding - How To Redirect One Domain to Another Domain - Simple Steps + One Caveat

Content

There are many reasons why you might want to forward a URL and a few basic ways to reach it. For a website with a lot of hits and good results showing on search engines but having to change the domain name, forwarding is the appropriate choice in this conversion process. Visitors to the old domain name will automatically forward to the new domain. Over time, when the database is updated by the search engine, the new domain name will be displayed on the search results. You perform URL forwarding when you need to redirect some other URL to a web address, or want to shorten a complex URL. The method of URL forwarding depends on your website programming code and experience with confidence when editing it.

Steps

Method 1 of 4: Write a Forward.htaccess code 301


  1. Find the site running on the Apache server. This is required to continue method.htaccess - check web provider if you are unsure.
  2. Locate and download the .htaccess file. The .htaccess file is a file where your web provider checks information for error handling, security, and for forwarding site requests. Check the root directory (where all the website files are stored) and download the file for editing.

  3. Create .htaccess file. If you don't see .htaccess in the root directory, you can create the file using the Notepad app (or similar text editing app). File code in next step.
    • Be sure to save the filename .htaccess begins with a "."
    • Note the file has no extension (eg ".com" or ".txt")
  4. Insert code. Paste the code below into the .htaccess file:.301 redirect /old/oldURL.com http://www.newURL.com
    • In the code, "oldURL.com" is the web page from that the visitor is forwarded, while "http://www.newURL.com" is the forwarded visitor site come.
    • There must be a space between "oldURL.com" and "http: //"
    • Don't add "http: // www" to the (old) URL in the first part of the code!
    • The "301" code is commonly used on a forwarding page and "permanently moved". Study more about the code "300" for other functions.

  5. Set a new destination URL. Change "http://www.newURL.com" to the domain address you want visitors to be forwarded to.
  6. Save the .htaccess file. In the "all files" section, choose to save the .htaccess file with no extension.
  7. Create backup. Rename the .htaccess and html file of the same name to keep a backup. For example, use the name.htaccessbackup so you can find and locate the file in case you need to restore code from earlier.
  8. Upload the modified file to the root directory of the old domain name. Now you can modify the code if needed, place the file in the old URL for reading and forward as intended.
  9. Check transition. Open a private browser window and type old domain name in the address bar. Once you've done everything correctly, the web page will redirect to the new page.
    • Use a private browsing window to ensure that your browser accesses new transitions instead of relying on caching data (data stored for faster entry or access).
    • In a private browsing window, you can clear your browser's cache through the custom menu. For more information, read the article Clear-Cache-by-Browser.
    advertisement

Method 2 of 4: Using a Relay Service

  1. Check with web provider. If you are unsure of your ability to code or want to forward the URL without touching the code, you can use the forwarding service pages and your web provider may be one of them. Many web providers have forwarding and companion support services to help you reach your goals. Test this functionality with your current web provider or contact them directly for options.
  2. Choose an intermediary service. If your web provider has no forwarding service, you can choose an intermediary service. Depending on the type of transition you need, you can find a free service.
    • Many services allow you to configure forwarding options, such as whether the transition type (permanent or temporary) or query parameters are passed.
    • Only a handful of services allow you to forward HTTPS (secure) paths.
  3. Follow the direction of the forwarding service. Usually, the services are very friendly and have step-by-step instructions that make it easy to do.
    • Note: In some cases, you still need to edit the DNS (Domain Name System) record of the domain you want to forward. You can access it from the website of the provider.
  4. Update DNS records. The intermediary relay service will notify if you need to access and edit these records through the server account.
    • The instructions for editing the DNS records in this step are entirely dependent on the service you use, usually both translator and web provider have simple instructions.
    advertisement

Method 3 of 4: Use the Meta Command

  1. Access the code snippet of the page you want to forward. Here is another method in which directly changing the code of the page, you need to load the file associated with the URL from that redirect to another page.
    • Note: in most cases, using the Meta command for forwarding is not the ideal way. Websites with meta transitions are often screened by search engines because it is an unknown technique.
  2. Open the code for editing. Use "Notepad" or similar text editing software to open the page code file. Save a copy before proceeding with any edits, just in case.
  3. Edit the code. The meta code begins after the "head" tag () in the snippet of the page. Import :
    .
    • There is a space between "refresh" and "content".
    • "0" is the number of seconds before transitioning.
    • "www.newsite.com/newurl.html" is the forwarding page address next.
    • It can generate custom error messages or notify that your site has moved, but this will attract unwanted attention to the forwarding page!
  4. Save the file and re-upload it to the old site. If you forward the hit from the old URL, more likely that other changes have been taken over in the URL snippet (eg, removing the page content). It is important that the current URL code contains the meta transition code.
  5. Forward test. Enter the URL in your browser's address bar or use the search engine to find it. The website will immediately switch to the new URL written in the snippet without any notice or interruption. advertisement

Method 4 of 4: Using Other Programming Languages

  1. Find your website programming code. For each programming language, the transition code is a little different. If you are unsure of the answer to this question, contact your web provider for more information.
  2. Study other relay codes. There are many different coding commands for each language, and many options to explore within each language. Search the internet to determine the code that's right for your website.
    • For example, you can easily learn about PHP, ASP, ColdFusion and Javascript forwarding code on the net.
  3. Forward test. After finding the right code for your site, the execution is similar to other coding methods. Then don't forget to forward test by going to the (old) URL to see if everything is working as planned. advertisement

Advice

  • Users of FrontPage (a well-known website for admin tools) need to modify the.htaccess file in _vti_bin and the _vti_bin _vti_adm and _vti_aut subdirectories.
  • While some websites use the error page to explain URL redemption and include a clickable forward path, it is less efficient than automatic forwarding and can reduce pageviews. new.