SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress redirects

    Hi,

    I am running WordPress and I have about 20 different urls as alias to our main url.

    I have domain.co.nz, domain.net.nz, domain.cc and domain.com.au , domain.net

    I need to redirect all www.domain and domain. to our main url of www.domain.net

    What is the best rules to do this in the .htaccess directory

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    Malaysia
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To Redirect Entire Site:

    Redirect 301 / http://www.example.com/
    Bored with reading SEO text article? Visit our blog,
    we collected interesting SEO Infographic.
    We are local SEO company in Kuala Lumpur, Malaysia.

  3. #3
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by patrick0001 View Post
    To Redirect Entire Site:
    Hi

    That did not work, firefox complained about incorrect redirects

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    SPECIFICITY!

    If the domain is not www.domain.net, make it so.

    That is easily encoded in mod_rewrite as:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
    RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]
    Since you're using WP, REMOVE the <IfModule> wrappers and insert this RewriteCond and RewriteRule immediately after WP's RewriteEngine on statement.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi DK,

    Spot on, thank you for your assistance.

  6. #6
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Cs,

    Sorry, I overlooked the fact that you're new here so a belated Welcome to SitePoint! to you!

    Then, do you understand the reason to delete the <IfModule> wrapper?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  7. #7
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi DK,

    Must be honest, no. I was having a problem with WP dealing with multiple domains and would love to have a better understanding


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •