by monere
2 replies
hi

I have a non-Wordpress website that I would like to redirect entirely to Wordpress using .htaccess but I don't know how to do this.

The domain name will remain the same, but this time it will point to a new website that I have created on a different hosting account from a different hosting provider.

Here are 3 questions whose answers will help me know how to proceed

1. Is it better (in terms of SEO and clean redirection) to do this through the use of any Wordpress redirection plugin or must this be done through the htaccess file? And if it does make a difference which method I use, why is it better to do one over the other?

2. If I take the htaccess redirection route, what exactly do I need to type in the file? Also, do I need to redirect each page individually or is there a command or something that will redirect the whole thing in one shot?

3. Also, which htaccess file should I write the redirection code in: the one located on the current account or the one located on the new folder where I set up the website on Wordpress?

Please give some instructions as I never understood the deal with htaccess

Thanks
#htaccess #redirection
  • Profile picture of the author SebastianJ
    If the domain name will remain the same you'll have to point your domain to the new name servers or the new ip for the new hosting account. You change this at the registrar where you registered your domain - this has nothing to do with .htaccess at all.

    If you would have had an old domain that you wanted to point to a new one then that would've been a case for a site wide .htaccess that redirected old urls to the new domain.

    What I would suggest is that you add a wordpress redirection plugin to your new wordpress site and as nearly as possible try to map the old urls to new ones using this plugin.

    Say for example that at your old site, you had "http://domain.com/about-us.html", then you'll add a 301 redirect to "http://domain.com/about-us" given that this is the new url and that you use permalinks.

    If you have a lot of posts with a common pattern, e.g. files ending with .html, and want to redirect these to an equivalent without .html (about-us.html -> about-us) then you'll probably do this a lot faster using .htaccess than manually adding redirection rules in your wordpress plugin for each and every post.

    This can be done with example the following:
    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^(.*).html$ $1 [R=301,L]
    EDIT: There should be a \ (backslash) before the '.html'-part but it gets removed whenever I try to enter it in the code-block.
    {{ DiscussionBoard.errors[4505611].message }}
    • Profile picture of the author monere
      Originally Posted by SebastianJ View Post

      If the domain name will remain the same you'll have to point your domain to the new name servers or the new ip for the new hosting account. You change this at the registrar where you registered your domain - this has nothing to do with .htaccess at all.

      If you would have had an old domain that you wanted to point to a new one then that would've been a case for a site wide .htaccess that redirected old urls to the new domain.

      What I would suggest is that you add a wordpress redirection plugin to your new wordpress site and as nearly as possible try to map the old urls to new ones using this plugin.

      Say for example that at your old site, you had "http://domain.com/about-us.html", then you'll add a 301 redirect to "http://domain.com/about-us" given that this is the new url and that you use permalinks.

      If you have a lot of posts with a common pattern, e.g. files ending with .html, and want to redirect these to an equivalent without .html (about-us.html -> about-us) then you'll probably do this a lot faster using .htaccess than manually adding redirection rules in your wordpress plugin for each and every post.

      This can be done with example the following:
      Code:
      Options +FollowSymlinks
      RewriteEngine on
      RewriteRule ^(.*).html$ $1 [R=301,L]
      EDIT: There should be a (backslash) before the '.html'-part but it gets removed whenever I try to enter it in the code-block.
      Thanks for the tips. Luckily me I only have a 30 page website, and for the newly created website I even removed 10 or so of those 30 pages so that I only actually have 20 pages of content (no comments on any of them), including the standard pages (about us, contact, privacy policy, sitemap, etc).

      So, I guess I will not mess with .htaccess then and only stick to the redirection plugin. Whew!

      Thanks again for saving me some headaches
      Signature

      Try not to become a man of success but rather to become a man of value - Albert Einstein

      {{ DiscussionBoard.errors[4505866].message }}

Trending Topics