1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

using htaccess how to remove www from site link

Discussion in 'XenForo Questions and Support' started by aiman.h.kallaf, Jun 12, 2012.

  1. aiman.h.kallaf

    aiman.h.kallaf Active Member

    i have htaccess file on my site root
    is there any code that i can write their to make
    www.english4me.net/forum become
    english4me.net/forum

    i tried this but did not work

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

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

    CyclingTribe Well-Known Member

    Try this:

    Code:
    RewriteCond %{HTTP_HOST} ^www\.english4me\.net$ [NC]
    RewriteRule ^(.*)$ http://english4me.net/$1 [R=301,L]
    
     
  3. Pereira

    Pereira Well-Known Member

    It's probably a complete n00b question but does anyone know how to decipher each bit of code in the above post?

    I've used the same code in the past but I've noticed there tends to be different variations. For instance what does the "[R=301,L]" do?
     
    aiman.h.kallaf likes this.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Pereira and aiman.h.kallaf like this.
  5. aiman.h.kallaf

    aiman.h.kallaf Active Member

    I tired it and it does not work
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    aiman.h.kallaf likes this.
  7. aiman.h.kallaf

    aiman.h.kallaf Active Member

    RewriteEngine On

    RewriteCond %{HTTP_HOST} !^english4me\.net$
    RewriteRule ^(.*)$ http://english4me.net/Forum/$1 [R=301,L]


    still not working . i don't know why but it is not a big deal no harm in loge in twice
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Make sure the .htaccess file is in the Forum directory.
     
    aiman.h.kallaf likes this.
  9. aiman.h.kallaf

    aiman.h.kallaf Active Member

    it is not in the Forum , it is on the root , one minute i'm gona try
     
  10. aiman.h.kallaf

    aiman.h.kallaf Active Member

    yep , thank you very much , it works
     

Share This Page