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
  • 15-01-2008 4:16pm
    #1
    Registered Users Posts: 648 ✭✭✭


    hi

    i want to redirect all requests comming into my site as http://domain to http://www.domain
    that would be simply the below in a htaccess file :
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
    

    however i want to unsure that all https:// requests actually have no www. therefore like this https://mydomain.com
    therefore if a https is called for and a www. exists then it gets redirected to url without www.
    anyone know how to do the last part ?

    cheers


Comments

  • Registered Users Posts: 648 ✭✭✭ChicoMendez


    in fact if i do the below the script will stall cos it runs into a loop
    redirect 301 /sc/category/machines-8/desc/id/page-1.html http://www.xxxx.com/sc/category/machines-8/desc/id/page-1.html
    


    and this will not work

    redirect 301 http://xxxx.com/sc/category/machines-8/desc/id/page-1.html http://www.xxxx.com/sc/category/machines-8/desc/id/page-1.html
    


    anyonw know how to sort that ?


  • Registered Users Posts: 648 ✭✭✭ChicoMendez


    anyone ?


  • Registered Users Posts: 1,452 ✭✭✭tomED


    I do this for other domains we have, u should be able to hack it! ;)
    If not let me know and i'll do it for ye.

    RewriteCond %{HTTP_HOST} ^(www\.)?2bscene\.eu$
    RewriteRule (.*) http://www.2bscene.ie/$1 [R=301,L] 
    

    EDIT: Ooppss just noticed the bit about https, I have something done somewhere else, will dig it out.


  • Registered Users Posts: 1,452 ✭✭✭tomED


    I couldnt find that site that i did it on before, but from memory i checked to see it the SSL was off and redirected accordingly,

    RewriteCond %{HTTPS} off


  • Registered Users Posts: 648 ✭✭✭ChicoMendez


    RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
    


    Hi,

    i tried using this - but i get an internal server error !

    any ideas on that or in fact on my second post ?


    cheers


  • Advertisement
  • Registered Users Posts: 1,452 ✭✭✭tomED


    weird, you have the "RewriteEngine On" I'm assuming?


  • Registered Users Posts: 648 ✭✭✭ChicoMendez


    yes indeed its on - strange alright

    im using other 301 redirects in the .htaccess file so the rewrite engine is on alright.


Advertisement