Problem with .htaccess. please help me.

Discussion in 'Search Engine Optimization' started by pareshprince, Dec 8, 2008.

  1. #1
    Hello friends

    i have some problem with 301 permanent redirect. i want to redirect my site to http://xys.com to http://www.xys.com. so i was put the code in .htaccess file but that is not working. i was write below code in .htaccess

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^xys.com [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*) http://www.xys.com/$1 [L,R=301]

    and my site hosting with lunarpages and lunarpages by default mod_wirte is enable and i was put .htaccess file in that folder where index.aspx file.

    if i am wrong any step then please suggest me.

    so please friend help me.

    Thanks a lot in advance.
     
    pareshprince, Dec 8, 2008 IP
  2. sultanofseo

    sultanofseo Notable Member

    Messages:
    9,930
    Likes Received:
    405
    Best Answers:
    0
    Trophy Points:
    265
    #2
    this is what i use myself
    RewriteEngine on
    rewritecond %{http_host} ^abc.com [nc]
    rewriterule ^(.*)$ http://www.abc.com/$1 [r=301,nc] 
    Code (markup):
    however, this is for linux based hosting. if you have windows hosting, you would need some other code. google "htaccess 301 redirect" or something along the line and you will find lot of help

    keep in mind that after changing the code, your server might take a little time before the redirect starts working. i would say allow about 15 minutes or so before you change the code back
     
    sultanofseo, Dec 8, 2008 IP
    poseidon likes this.
  3. pareshprince

    pareshprince Active Member

    Messages:
    156
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #3
    thanks man
    my hosting is windows web hosting. so is there any code. if yes then tell me.
     
    pareshprince, Dec 8, 2008 IP
  4. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ahmed's code looks right to me, so give it a try.

    You may like to check http://forums.digitalpoint.com/forumdisplay.php?f=18 forum too for more apache and .htaccess related content

    Edit - just saw your post, so you are on IIS ? I don't have much knowledge of IIS and what lunarpages is providing but you can look at these steps -

    In iis Admin:

    1. Browse the website you want to do the redirect for.
    2. In the right pane, right click on the file you want to redirect, and click "Properties"
    3. Under the "File" tab, hit the radio selection "A redirection to a URL"
    4. Put the target in the "Redirect to" textarea.
    5. Make sure "The exact URL entered above" and "A permanent redirection for this resource"

    Ref - WMW
     
    poseidon, Dec 8, 2008 IP
  5. pareshprince

    pareshprince Active Member

    Messages:
    156
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    #5
    thanks for good info.
     
    pareshprince, Dec 8, 2008 IP
  6. sultanofseo

    sultanofseo Notable Member

    Messages:
    9,930
    Likes Received:
    405
    Best Answers:
    0
    Trophy Points:
    265
    #6
    well, then you are going the wrong direction to begin with. htacess files dont work with windows and only way to do a server side redirection with windows hosting is by having access to your IIS admin panel which you dont have. you need to use javascript on each page to redirect them to new page which is pretty much the only way you can do this unless you can have your host do this for you in the admin panel. again, do a search on google for windows 301 redirct for the code as i dont use windows server so dont have the code handy

    @ poseidon, op is using lunarpages as a host and not hosting his site on his own IIS server so dont have access to IIS admin panel.
     
    sultanofseo, Dec 8, 2008 IP
  7. dream_sonu

    dream_sonu Well-Known Member

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    123
    #7
    i think for better you can discuss programmer for that
     
    dream_sonu, Dec 8, 2008 IP