Announcement

Collapse
No announcement yet.

How to set up a .htaccess redirect?

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set up a .htaccess redirect?



    Code

    Redirect 301 /example/test.html http://www.yoursite.com/newlocation/newpage.html


    Cut and paste this code into your .htaccess file. "Redirect 301" means that it is a permanent redirect. You can change it to "Redirect 302" for a temporary redirect. If you have no number, then it will default to a temporary (302) redirect. Change the "/example/test.html" to your old location. Then put your new location in where it says "http://www.yoursite.com/newlocation/newpage.html". You are done
    admin
    Administrator
    Last edited by admin; 08-17-2015, 09:04 AM.

  • #2
    Create the . htaccess file on your computer using a text editor. ...
    Use your FTP client to access your site. Make sure to set your FTP client to view hidden files.
    Go to the public_html directory.
    Upload your new . ...
    When the upload is complete, exit your FTP client.

    Comment


    • #3
      AccuWeb.Cloud
      Hi,
      You can redirect your one domain to another domain with .htaccess file.
      There are various other ways to redirect your domain:
      - Redirect from hosting control panel
      - Redirect your domain with domain control panel
      - Redirect your domain with .htaccess file

      Here we are starting with .htaccess file, .htaccess file is a server configuration file and in this file you can make changes especially if you are on shared server. .htaccess file firstly detected and executed by Apache web server according to its functionalities.
      You can add below code to redirect your old domain to new domain so that your old traffic can be redirected to new one.

      Code:
      RewriteEngine on
      RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
      RewriteCond %{HTTP_HOST} ^www.example1.com [NC]
      RewriteRule ^(.*)$ https://example2.com/$1 [L,R=301,NC]

      Comment

      Working...
      X