Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

htaccess question

Options

Comments

  • Registered Users Posts: 7,739 ✭✭✭mneylon




  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    trick question, are they two different domains ?

    If not and you just want http://www.mysite.ie to go to http://mysite.ie then do this

    [PHP]

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^mysite\.ie$
    RewriteRule (.*) http://mysite.ie/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} !^www\.mysite\.ie$
    RewriteRule (.*) http://mysite.ie/$1 [R=301,L]


    [/PHP]

    Bear in mind, I can't think of any good reason why you'd want to redirect this way, normal circumstances you'd want to do the exact opposite for canonical url reasons


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Would this be better suited in the DNS config?


  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    eoin_s wrote: »
    Would this be better suited in the DNS config?

    I'm not sure if he already has pages indexed on the www side, this ensures that everything will now point to his choice, as well as notifying SE's correctly.


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    eoin_s wrote: »
    Would this be better suited in the DNS config?
    No

    People expect two A records for a website to exist, so you can't work around this using DNS


  • Advertisement
  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    blacknight wrote: »
    No

    People expect two A records for a website to exist, so you can't work around this using DNS

    Ah right, I thought you could just set up an alias for this kind of thing.


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    You mean a CNAME? You can, but it won't redirect anything, so it won't achieve what you are looking for


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    blacknight wrote: »
    You mean a CNAME? You can, but it won't redirect anything, so it won't achieve what you are looking for

    Sorry, must have been thinking of A records, which I thought was down to DNS configuration


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    eoin_s wrote: »
    Sorry, must have been thinking of A records, which I thought was down to DNS configuration
    It is, but you're confusing DNS with server configs.

    If a user opens http://somerecord they expect some kind of response, so you have to create records at DNS level for both the record you want to display and the one you don't want to display. Moving the URI around is handled by Apache / IIS / your web server config ie. rewriting the URI


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    blacknight wrote: »
    It is, but you're confusing DNS with server configs.

    If a user opens http://somerecord they expect some kind of response, so you have to create records at DNS level for both the record you want to display and the one you don't want to display. Moving the URI around is handled by Apache / IIS / your web server config ie. rewriting the URI

    I think that's about time for me to STFU so!


  • Advertisement
  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    I'm in the same boat as eoin, was about to ask for a lilnk explaining this for once and for all, but having intercepted the anticipated google is your friend response, the fruit:
    http://en.wikipedia.org/wiki/Domain_name_system
    and scroll down to "Types of DNS records".

    I'm going to read it.


Advertisement