Setting Up a Permanent 301 Redirect in .htaccess

A permanent 301 redirect in your .htaccess file lets search engines and others know that an old link has been replaced by a new one. It’s the recommended method for directing traffic from an existing page.

(For developers or sysadmins experienced with the command line, get High Availability and Root Access for your application, service, and websites with Cloud VPS Hosting).

Some common uses of a 301 .htaccess redirect:

You have the ability to setup redirects for a domain in your cPanel interface one link at a time. You can also add the redirects manually by modifying your .htaccess file directly.

Getting to your .htaccess file

On a Linux server you would use your .htaccess file to implement a 301 redirect for your pages.

  1. Login to your cPanel.
  2. Under Files, click on File Manager.
  3. Ensure that Show Hidden Files is selected by clicking on the gear icon in the top right corner of the File Manager.
  4. Select the Document Root for: option, and choose your domain from the drop-down.
  5. Right-click on the .htaccess file and select Edit.
  6. If your .htaccess file didn’t exist already during the previous step, click on New File at the top-left, name the file .htaccess, and finally set the directory for the file to be created to /public_html/ or the document root of your site.
  7. You might have a text editor encoding dialog box pop-up, you can simply click on Edit.
 

Redirect individual files

To redirect individual files, like example.com/oldfile.htm to newfile.htm you can use a 301 redirect like this:

Redirect 301 /oldfile.htm /newfile.htm
single file 301 redirect

To redirect one specific file to another domain such as example.com/oldfile.htm to example.net/newfile.htm:

Redirect 301 /oldfile.htm http://example.net/newfile.htm
single file domain 301 redirect

Redirect an old domain to a new domain

If you had an old domain such as example.com, and now you decided you actually want to use example.net for the website. You could setup a 301 redirect for the entire domain, so that old links to example.com carry over.

Code in the example.com domain’s .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]
full domain 301 redirect

Force www. version of domain to be used

A search engine like Google would see example.com and www.example.com as essentially two separate websites. They recommend you pick one version you’d like search engines to display and using a 301 redirect is a possible option.

If you have a lot of links on the web where people are linking to your site as example.com, but you would like your visitors to instead end up at www.example.com you can force this version of your domain with these rules:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
force www 301 redirect

Force non www. version of domain to be used

If you have a lot of links on the web where people are linking to your site as www.example.com, but you would like your visitors to instead end up at example.com you can force this version of your domain with these rules:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
force non www 301 redirect

Redirect all files with certain extension

To re-direct all of one type of file to another, such as example.com/file.php to example.com/file.htm

RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule ^(.*).php$ /$1.htm [R=301,L]
file extension 301 redirect

You should now know how to properly setup 301 permanent redirects on your website to help ensure that search engines and visitors coming to your site from older links can still get to your new content.

Thoughts on “Setting Up a Permanent 301 Redirect in .htaccess

    • If you check this in a search engine several possibilities appear. It can result from issues with settings in your .htaccess file. You need to check your code in the .htaccess file for redirect loops. If you’re not familiar with how to do this, then you may need to consult with an experienced developer/programmer.

  • On a rewrite with over 50,000 pages with redirects on half of pages what is the best practice?  Is there a limit to the file size?  How long should you leave the redirects in the file? 

    • There is no limit on the file size, however, it will need to be balanced with the server load during high levels of traffic. If your visitors are each hitting a file that has 50,000 checks, it may cause the site to render more slowly if there are more visitors. For best practices, I recommend reviewing Moz.com as SEO experts their forums typically provide some good insight into best practices. I hope this helps!

  • Hi! I need some help please, I have a wordpress hosted site. I have moved my images from wp-content/uploads to media.mysite.com and I dont have any clue how  redirect the old folder to the new subdomain from htaccess. There should be like a 301 redirect code to tell search engines that ive moved my media files from the wp media folder to a subdomain. Could you please help me?  Thank you!

    • Below is a solution I found while researching online. I recommend trying this code in your .htaccess file where your WordPress installation is.

      RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [OR]
      RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
      RewriteRule ^wp\-content\/uploads\/?(.*)$ "http\:\/\/subdomain\.yourdomain\.com\/$1" [R=301,L]

      This should redirect all requests for the wp-content/uploads directory to the subdomain. However, you may need to customize this to work for your custom configuration.

      I hope this helps!
      Sincerely,
      Carlos D.

  • Hello,

    Good Blog for the 301 permanant redirection. i want to remove my all the pages .php extention and want to add “/” slash in end of the every url. can you help me in this.

     

    • The proper way to do this depends on how the website was built. What software did you use to build your website?

    • If you’re using the “ahref” as your code then it is not a redirect. Please review this article as it provides the redirect code that can be used in your .htaccess file. If Google continues to refuse it, then you may need to send them a message for clarification of the issue.

  • Hi, very helpful article.

    I have one issue here and I would like your help. Due to rebranding reasons we bought a new domain name. I have accomplished to redirect all the requests from http://www.siteA.gr to http://www.SiteB.com but I want to do the same for all the old pages and URL in order to redirect them to the same URL / path under the new site.

    For example if someone goes to http://www.siteA.gr/about.html to be redirected to http://www.siteB.com/about.html or http://www.siteA.gr//career/ to be redirected to http://www.siteB.com/career/ etc. There are dozens of URLs and I want to avoid to write specific redirect rules for each one of these. Is there any generic redirect rule that I could use to do it simultaneously for all the URLs?

     

    thanks

    • Hello,

      i, very helpful article.

      I have one issue here and I would like your help. Due to rebranding reasons we bought a new domain name. I have accomplished to redirect all the requests from http://www.siteA.gr to http://www.SiteB.com but I want to do the same for all the old pages and URL in order to redirect them to the same URL / path under the new site.For example if someone goes to http://www.siteA.gr/about.html to be redirected to http://www.siteB.com/about.html or http://www.siteA.gr//career/ to be redirected to http://www.siteB.com/career/ etc. There are dozens of URLs and I want to avoid to write specific redirect rules for each one of these. Is there any generic redirect rule that I could use to do it simultaneously for all the URLs?

      It sounds like you have already accomplished that if you’re redirecting all of the requests to the new domain name. If you’re trying to avoid having to re-write paths so that they show a specific path (e.g. http://www.siteB/about.html), then you will need to make sure that the same exact folder structure exists in your new site. Then, it would be a simple matter of replacing the old domain with the new one. If you are running into problems with with the paths, then there has been a change in how your files are located in the new location. Make sure that your files and folders are named the same and in the same location under the new domiain.

  • Hello,

    I migrated from http to https recently and although the site is working perfectly,  when I upload the new version, which I reverified as a new identity with Google Console, the new version show different number of internal links and “links to your site”. I finished the transition process in WordPress with “Real Simple SSL plugin” did that not change the settings?  Is there another step I am mising? I  am still seeing people accessing the http version too.

    Many thanks for your help,

     

    • Hello,

      If you are forcing HTTPS, it may be that you have pages cached that are not HTTPS. Check your URL using a utility site like Why No Padlock? It should identify any unsecure links. Make sure to clear any caching on your site. If you continue to have problems then you should first try our live technical support team or speak with an experienced website developer/programmer.

  • Hello, if migrating my site from olddomain.com at old hosting company, to newdomain.com with a new hosting company, will I need to keep my old hosting account active while the 301 redirect is in place? Or do I simply need to maintain my olddomain.com registration, without hosting? Thank you!

    • In order for the redirect from olddomain.com to continue to redirect to newdomain.com, you will need to host that 301 redirect on a server somewhere. Whether that is your old host or new host, it doesn’t matter. However, if you cancel your hosting for olddomain.com then the redirect will no longer function.

  • I’ve moved a website from an old domain to a new one and used .htacces to direct any old links to go to the new site.

    Do I need to save old domain name rented also, or I can stop paying for the old domain?

    • Hello! Thanks for posting your comment regarding your website’s functionality using www and non-www URLs and /index.php. I’m sorry to see that you are experiencing issues with that. The code in this guide is intended to generally assist with this. However, if you are using a CMS (like WordPress, Joomla!, Drupal, etc) the code may not work.

      To reiterate, if you want to force all traffic to go to http://www.example.com, you will need to add the following code to the top of your .htaccess file:

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

      You may also be able to select to hide the /index.php portion of the URL depending on the CMS you are using. If you can reply with which CMS you are using, we may be able to assist you further.

  • Hello,
    I am trying to redirect a site. most of the pages are redirected by “Redirect” one page to another. but I have a lot of old pages with no pare on the other side.
    I would like to redirect all of those pages to the new homepage.com
    how can I redirect all of them as long as they are not ion the list of the regular Redirect lines?

    • That code is very specific and would require a custom solution. Therefore, I recommend reviewing the Apache documentation to determine the code you should use. Otherwise, I suggest finding a developer to write that specific code for you.

  • I have a question:  How do I build a 301 redirect in my .htaccess file for the following.  My DOMAIN is http://www.vintagevogue.com  My ecommerce was located at: https://www.vintagevogue.com/onlinestore.  My new ecommerce is located at https://www.vintagevogue.com/pres156.  I want to ensure anyone going to the OLD ecommerce files will be redirected to my NEW ecommerce files.  All of the file names have changed along with the pictures from /onlinestore to /pres156.  So basically I’m trying to ensure if anyone goes to the /onlinestore that they be redirected to /pres156.  Any assistance you can provide would be greatly appreciated.  Thank you !!!

    • You would use the old domain to new domain example in the tutorial above. You would simply need to include the entire path for the old and new locations.

  • i’m chnge my forum root from

    shneler.com/vb/ to shneler.com/ 
    

    I’d like to redirect subdirectory (vb) to a main domain without losing the index in google. Example:

    www.sneler.com/vb/node/post.no1  to www.shneler.com/node/post.no1
    

    and please note i have 20000 post thread in my forum already archive in google index

    • You can use the old URL to NEW url displayed in the tutorial above. You would simply need to make sure that the URL you are using in the rewrite rule includes the subdomain you wish to use. If you want more information about 301 redirects and how it helps to preserve your ranking, please see this article.

  • Hi, i’ve tried doing 301 redirect from your above example on my new design website. How can I undo the code? if I type the domain name without the “www.”. Your Example.net keeps showing up.. How can I undo this? Please Help!!

  • Hi

    How to redirect every single file from all directories and with all extensions from old site to the homepage of the new site?

    Thanks

    • Your best bet likely be a domain redirect at the root level. There are instructions above on how to do that.

  • Hello. 

    I am moving all content from my site/domain jimmyfuentes.com to a new site / domain . I am using updraft plus to migrate it so everything will literally be exactly as it was on jimmyfuentes.com with the only difference being the root domain. 

    I need to put 301 redirect in the htaccess for jimmyfuentes.com for EVERYTHING except for the root domain  of jimmyfuentes.com because I am going to be  building new and different content on jimmyfuentes.com . Basically, How do I 301 all of the old page urls, image urls, etc but keep the root domain jimmyfuentes.com and any future pages I build on jimmyfuentes.com safe ?  

    Thank you for any and all help

    • The redirects described in this article will not work in the manner that you are asking about. This is because you would need to redirect each file using the code:

      Redirect 301 /oldfile.htm http://example.net/newfile.htm

      However, this would restrict you to only making files on the “old” domain that have a unique name from the “new” domain. Also, this would require that you set a redirect for each file, which is tedious. Otherwise, there is no way to accomplish what you are describing.

    • You are welcome! We are glad to see that this article was able to help you. Please feel free to let us know, “Was this article helpful?” by clicking the “Yes” or “No” button located above the article you would like to leave feedback on. Your feedback ensures we are able to continue to provide helpful content! Thanks.

  • I checked every possible reason/option but our site links to another website if we use https://websitename. I cannot find the reason. It is not an alias, not redirecting also. It only happens when using https:// not when using http://. Please enlighten me and help me to solve.

     

    • The SSL certificate used for the HTTPS URL can be assigned to a specific IP address. If this IP address is different from your non-HTTPS URL, then the website may look different. You will need to directly speak with your host’s support team to double-check your URL in order to determine why the URLs are going to different locations. The live technical support team can be contacted as per the information at the bottom of this page.

  • thanks so much. The code worked. I am greatful and so happy that al referals links on our website are finally redirecting to the new link with the same structure. LOVE YOU GUYS

  • I have redirected my site http://freeasp.net to http://cheaperasp.net via htaccess using your guide. Both of my sites are on WordPress. Now I want to login to my old site i.e FreeASP to access some information but when I am typing the login URL, it is redirecting to my new site. Kindly help how can I access my old site.

    • You need to create an exception rule for the login URL that processes BEFORE the general re-direct. It should specify the login URL so that you can get to it before the redirect to the new site URL processes.

  • How it is possible to redirect any old domain to a new one. There are some old domains I don’t no anymore but on the new server there are a lot of 404s. Iwant to redirect any domain without setting a specific name

    Thank you

    Regards

    Andreas

    • We have some redirect rules listed above under the heading “Redirect an old domain to a new domain” in order to handle that request.

    • Redirect instructions for this case are provided in the above article under the heading “Redirect an old domain to a new domain.”

  • Great job! Very helpfull, but i have a doubt:

    I want to redirect the http://www to https://www

    In that case, please, verifu if i did right doing this: (for security purpose, i hide the domain after the www.)

    # BEGIN WordPress

    <IfModule mod_rewrite.c>

    Options +FollowSymLinks

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^http://www./ [NC]

    RewriteRule ^(.*)$ https://www./$1 [L,R=301,NC]

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . /index.php [L]

    </IfModule>

     

    # END WordPress

     

     

    Thanks

    • Hello,

      If you want to redirect all of that path to the root domain then you go into cPanel and use the wildcard to represent the different folders or files in the URL. Keep in mind that if you want to use a 301, then you are basically telling search engines that this is a permanent change. Do not use a 301 redirect if you are not changing the paths.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  • Awesome site and kudos for so generously helping folk. I’ve added the code to my .htaccess file and now oldname.com goes to newname.com perfectly. However, weirdly, the posts are not going though – they are resolutely oldname.com/posts and will not re-direct. The post naming structures are definitely the same…  I’ve tested with multiple posts by simply changing the ‘newname’ to ‘oldname’ bit of the URL. Any suggestions? And many thanks.

    • We’re always happy to help! It sounds like you are trying to change the domain for your website, rather than change one URL/file/path to be redirected. Due to how WordPress sites are designed, you can not simply change and redirect the URL. As you can see the posts and other components may not work properly. I can recommend you try using the Velvet Blues Update URLs plugin to update your URLs when changing the domain name of your website. This will not require any redirects.

      Otherwise, I recommend you contact a third party developer to write code to customize the behavior you want for your domain redirect.

  • Will the code below direct example.com to example.net AND also FORCE NON WWW version of example.net to be used?

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^example.com [NC,OR]

    RewriteCond %{HTTP_HOST} ^www.example.com [NC]

    RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]

  • Excellent information,

    Very useful support to the website redirections up a 301 permanent redirect via htaccess files setup.

  • Is there an article that you can send me that would help explain the process? I was told that can’t happen. 

    • Hi, Richard!

      Thanks for your comment. If the redirect does not work via the standard .htaccess code I provided, then I would need to know what Content Management System (CMS- like BoldGrid/WordPress, Joomla!, Drupal, etc) you used to build the site. With that information, I can review our Support Center and/or the CMS’s documentation to possibly assist you further. Can you advise which CMS you used to build the site, in the original location?

  • How can i redirect my site to another server hosting without change nameserver because i want ti keep old server for emails. I want to build new site with PyroCMS and doesn’t work on the old server

    • You can do this by pointing the ‘A record’ for your domain to the IP of the other host.

      Keep in mind, if your MX record is pointed to that domain you should create a new entry to use for email.

      For example, create a subdomain such as “mail.example.com” (be sure to replace example.com with your actual domain).

      Point the ‘A record’ for “mail.example.com” to your shared IP address.

      Then, use “mail.example.com” for your mx record such as:
      0 mail.example.com

      Thank you,
      John-Paul

  • Those .gifs are confusing. Im spending alot of time trying to understand them. they move too fast for me. 

    Thats my first minor complaint here in a year. I really have enjoyed this service. Thank you for providing all of this information. you guys are very helpful

  • Actually, I have a website using https and I want to move it to a new domain using Https too.

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

    Is this code will work for moving https site to new https site?

    • Hello Raghav,

      I checked on this issue in several forums and the one that best explains it can be found here. I hope this helps to clarify the issue. If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  • Hi There,

    Thanks for the information.

    I have a question if you could help me.

    I have created a new website but without http version my old websited opens up.

    How can i resolve http issue.

     

    Cheers Komal

  • This is clearly written, thanks for this!

    However I have a site that no longer exists but I still need to redirect that traffic over to another site folder. I used. 

    Redirect 301 / http://newdomain.com/new-folder

    Which works, the www.oldsite.com is replaced with http://www.newsite.com but if someone has bookmarked an address that is not changed so

    http://www.oldsite.com/some/random/bookmark becomes http://www.newsite.com/some/random/bookmark. Which gets Page does not exist. Quite right too, it doesn’t exist. How can I get everything and there are many pages just replaced with http://newdomain.com/new-folder.

    Appreciate your input.

    • The easy, but tedious, way would be to add a rule for each URL you want to redirect. Or, you could have a developer build some custom rules that take into account the directory structure of your site and achieve the result you need.

  • Hello Arn, you’ve been quite wonderful on this post assisting others and wondered if you could point me in the right direction on this issue?  

    The old site is Joomla site on oldname.com domain. It hasn’t been updated in several years and a total mess, throwing up errors and warnings.

    New redesigned site and content is on WordPress with newname.com domain with a new domain/web hosting company.  We’ll work through creating the 301 redirects per your instructions above.  

    Though the new site has newname.com as it’s domain, we would ideally like to use the oldname.com domain for the new site.  

    It sounds like for SEO purposes, we should leave the redirects active for a little while on the oldname.com’s web hosting server, and don’t do anything with the oldname.com domain for now. Then after a period of time, we can point the oldname.com domain to the new nameservers?  

    Or can we point to the new nameservers now and just leave the oldname.com web hosting active during this transition?

    Appreciate your thoughts!

    • Yes, we recommend keeping the old domain up for a while to allow you to continue 301 redirecting to the new site. It is okay to point the nameservers over, as long as there are 301 rules in place at the location you are pointing.

      Thank you,
      John-Paul

    • Hello Xman,

      If you’re trying to redirect to a new domain, use the options provided in the second option in the article above. If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  • Thanks man, I just though that itsetad of installing a plugin, why nit do some coding and it took less time to redirect a page from .htaccess file as compare to install a plugin and add an entry.

    • Since many CMS’ (such as WordPress, Joomla, Drupal, etc.) rely on .htaccess rules, there are times when rules can can interfere with functionality. If you begin experiencing issues, then I do recommend using a plugin as a test.

      Thank you,
      John-Paul

  • What is the best method to redirect from one domain to another if we are going to take down an old site and redirect the domain name? Both htaccess and 301 redirect comes to mind. I am trying to wrap my mind around where to send as the redirect in the domain settings. We want to send people to a specific page, not just the home page. Does anyone know if we can send people that type in a domain that we are redirecting and all pages requested go to a page on another site we already have? 

     

    Redirecting domain: http://www.emulation.com

    Desired redirect: http://www.isipkg.com/emulation

     

    Can this be done? If so how? What about a wildcard send that has emulation.com/anything.html in the URL?

     

    Thanks, Tom

    • Hello Tom,

      The article above covers the condition that you are referring to. You should give a period of time where the old domain URL is being redirected to the new one and you alert your viewers. If you intend to shut down the website where the URL is hosted and your new site is already running, then you may want to consider renewing the old domain temporarily if you do not have a sufficient period of time to alert your users to the change. Here’s one article that discusses best practices for 301 redirects. Also, you may want to review Google’s take on the subject here.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  • Hi, I recently created a new website under a new domain name. MOST of the old content has a counter-part page on the new site although the content was revamped and a few pages consolidated. How should I best redirect traffic given that the URLs will not match up (i.e. not as simple as switching from .com to .net)? Do I need to put lines in .htaccess for each URL? How would requests to the main landing page be redirected?

    Thanks so much!

    • Yes, for the individual pages that do not have a counter-part, you will need a specific redirect rule. Then, at the end, you can have the general rule so that it gets everything else.

  • Thank you for clearing my doubts. However can I redirect my old blogs from netsolutionsindia to netsolutionshq.com ? Will that create a duplicate content issue? Curently I have linked the blogs on my new website to the old website as presently both website are working. Please help me on this.

  • Thanks Tim! I gave it a try and it didn’t seem to work for me. I’ll keep researching it though. I was trying the two examples given on that website on the same sheet as my RedirectMatch. I’m not sure if that is where I would put the code. I also tried adding it to my functions.php page and that didn’t work either. 

    • Hello Will,

      Sorry for the issues with the re-direct. If the solution that Tim referenced earlier didn’t provide enough of a description then you can also check this reference from the WordPress Codex. It may provide the solution you need.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  • Hello, 

     

    I am looking to redirect my homepage only but only when not logged into WordPress. I am able to redirect the homepage right now using: 

    RedirectMatch ^/$ http://google.com&nbsp;

     

    How can I only redirect the homepage for those not logged in? 

     

    Thanks! 

    • I recommend trying several to see which one works best with your specific WordPress setup. There are many 301 redirect plugins available, view them here. Ensure it compatible with your version of WordPress.

      Thank you,
      John-Paul

  • Hi,

    We are transitioning to WordPress and we would like to redirect around 60 products from our previous shopping cart. What we need is this:

    Redirect from ourdomain.com/product-name to ourdomain.com/products/product-name using the .htaccess file.

    Thank you very much for your help.

    • Since WordPress relies on .htaccess rules/rewrites, adding custom rules can interfere with the functionality of the website. Instead, we recommend using a plugin to create 301 redirects from the old pages to the new ones.

      Thank you,
      John-Paul

  • Thank you for this very clear article!

    I am currently redirecting users from a work server that will be discontinued in a few months to my personal domain at GoDaddy. The work server admin has set up a 301 redirect for me and it seems to be working well, but I am concerned about what will happen when the old server goes away. The 301 redirects are so smooth that I think users will not realize that they should update their bookmarks.

    Is there any way I can create a popup message or an intermediate landing page at my GoDaddy domain to remind users to update their bookmarks, while still retaining the 301 redirect function?

    Thank you for any advice you can give me!

    • Hello Pat,

      It is natural for old URLs to change especially after being re-directed for awhile. My recommendation is that you have the redirects in place as long as possible. Make sure that you are: 1) informing people about the new location and 2)displaying the new location in the browser when you re-direct them. You should put your reminder on the website where you’re redirecting. As long as you’ve done your due diligence with the 301 redirects, then it should be okay. This will be best not only for your customers but also for the search engines where the links must also change.

      I hope that helps to answer your question! If you require further assistance, please let us know!

      Regards,
      Arnel C.

    • Well, you have two different approaches and both have different effects on SEO. The first and easiest would be to follow the section above “Redirect an old domain to a new domain” and redirect any traffic from the old TLD (Top Level Domain) to the new TLD. This is fairly straight forward and easy to do. The problem is, you would lose the SEO value of the pages you already have ranking in the old website. The alternative, is to set up individual 301 redirects for each page in the old website. Each page would need to point to the respective page in the new site. This will pass most of the SEO value on to the new page.

  • Hello, I had the http:// version of my site but I bought an SSL certificate so now have the https:// prefix. How do I make sure that people who visit the http:// address get sent to the https:// site.

    I don’t have any money to spend yet so I need to do all this stuff myself but I’m still quite new to self hosted WordPress so I need all the help I can get at the moment.

    Thanks so much!

  • Whenever I try to add or remove redirects CPanel says it can’t do it because there are errors in the .htaccess file, so I have to go make the edits myself. But if I make the edits myself, like add a redirect, nothing happens. I need to redirect from vpgd.net/atcs to http://hotspotssoutheast.com/atcs. The edit is in the .htaccess file but it needs to be restarted or something? Not sure. Thanks.

  • Hi,

    I have a requirement to remove my context path from the url

    e.g.:

    test.hostname.com/contextpath/page1
    test.hostname.com/contextpath/page2?content=1

    the above urls should be accessed without the contextpath
    test.hostname.com/page1
    test.hostname.com/page2?content=1

    Can anybody help me to figure this out?

     

     

     

    • Hello Rajkumar,

      You would need to use a Rewrite rule in the .htaccess file to rewrite that path so that it appears without the context path. The only difference is that you’re not changing the query string. This tutorial on the Apache RewriteRule and query string does a good job of explaining it.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  • I have a doubt, is there a way to redirect example.com to en.example.com but still be able to access pages like example.com/articles/example ? 

    Thanks in advance for your help.

    Regards.

    • That should be possible, but as this issue has to do with the coding of your site or sites, we are not able to advise you on the exact code to do so. You will want to work with an experienced web developer, if you don’t have one already, to assist you in addressing this issue.

  • Hello,

    Can anyone can help me with somthing.. i need to merge 2 domain, and i have redirect domain1.com to domain2.com, domain have the same post… and i enter to domain1.com/post1 redirect to domain2.com a not to domain2.com/post1, how fix this??

    Please help

Leave a Reply to Dov Cancel reply