Redirect all links to www?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Skavenger
    Member
    • Sep 2005
    • 73

    Redirect all links to www?

    Hi, is there any way to redirect all the trafic from 'http://site.com' to 'http://www.site.com'? [you have this in vb.com]

    In the configuration options I put, in the cookies option, the address of my site with 'www', but if you try to login without 'www' you can't login correctly, so I need to do that redirect

    I hope you understood what I need

    Thank you
    Last edited by Skavenger; Mon 22 Sep '08, 4:07pm.
  • Andy Huang
    Senior Member
    • Feb 2004
    • 4602

    #2
    create a file called .htaccess in your web root directory; fill in these code:
    Code:
    rewritecond %{http_host} ^yourdomain.com          [nc]
    rewriterule ^(.*)$ http://www.yourdomain.com/$1   [r=301,nc]
    Best Regards,
    Andy Huang

    Comment

    • Skavenger
      Member
      • Sep 2005
      • 73

      #3
      I already have an .httaccess file with this
      Code:
      #    "404 Not Found",
      
      ErrorDocument  404  /foros/404.php
      And I added the code you put

      Code:
      #    "404 Not Found",
      
      ErrorDocument  404  /foros/404.php
      
      # Redirect
      
      rewritecond %{http_host} ^site.com          [nc]
      rewriterule ^(.*)$ http://www.site.com/$1   [r=301,nc]
      But the redirect is not working :S
      Last edited by Skavenger; Mon 22 Sep '08, 4:07pm.

      Comment

      • SaN-DeeP
        Senior Member
        • Dec 2003
        • 1352
        • 1.1.x

        #4
        RewriteCond %{HTTP_HOST} ^microzonex.com.ar
        RewriteRule (.*) http://microzonex.com.ar/$1 [R=301,L]
        this should work.
        TechArena - TechArena Community - Technology News - Tools Download - Tech Video - Gamer Guide - Hardware Review

        Comment

        • Skavenger
          Member
          • Sep 2005
          • 73

          #5
          Thank you, but... is not working :S

          Comment

          • Andy Huang
            Senior Member
            • Feb 2004
            • 4602

            #6
            You don't have mod_rewrite enabled; you'd have to get your host to enable the module for you.
            Best Regards,
            Andy Huang

            Comment

            • Skavenger
              Member
              • Sep 2005
              • 73

              #7
              Here is the solution

              Comment

              • Mohajer
                New Member
                • Aug 2006
                • 20
                • 3.6.x

                #8
                its possible to redirect www.site.com/forum ( or /forum/ ) to http://forum.site.com ? with .htaccess

                Comment

                Related Topics

                Collapse

                Working...