1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Redirecting a domain name

Discussion in 'Plesk for Linux - 8.x and Older' started by CBiLL, Jul 30, 2005.

  1. CBiLL

    CBiLL Guest

    0
     
    Is there a way to redirect a domain name "http://domainname.com" to same domainname with the www "http://www.domainname.com"

    I know Plesk already added it as an alias but I have a php script that is giving a cookie fits if someone was to visit our site using the domainname.com so I wanted it to redirect (add in the www to the domainname) when they visit the site by entering just the domain name without the www that the script cookie will work property.

    So is there a way to redirect them to a domainname with the www in Plesk?

    Thank you
    Bill
     
  2. CBiLL

    CBiLL Guest

    0
     
    Never mind I found the httpd.conf.include and changed the domain.com to www.domain.com redirecting the domain.com to the www.domain.com and removed the www alias from it.

    It seem to work.

    Bill
     
  3. hasit

    hasit Guest

    0
     
    hello,

    i am using plesk 7.5.4 for windows, can you guide me from where i can redirect all the pages which are without www to with www.

    for example, if i try to open domainname.com, it should automatically go to www.doomainname.com, like wise for domainname.com/abc.html should automatically go to www.domainname.com/abc.html

    can you assist me, how to achieve this?
    thanks, hasit
     
  4. Highland

    Highland Guest

    0
     
    You don't have to rewrite conf files to do this. Make a .htaccess file and put the following in it
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.domain\.com
    RewriteRule (.*) [url]http://www.domain.com/[/url]$1 [R=301,L]
    Now upload it into the httpdocs directory (it won't be shown in a FTP list but it's there) and you're done. Works for any url.
     
  5. hasit

    hasit Guest

    0
     
    this is a windows server will .htaccess work?
     
  6. Highland

    Highland Guest

    0
     
    This is a UNIX forum ;) But I can help you anyways.

    Unfortunately IIS doesn't support this natively. You can get around this by using ISAPI Rewrite which makes IIS work like Apache. Sadly the full version costs money but appears to be cheap per server.

    http://www.isapirewrite.com/
     
  7. Peekay@

    Peekay@ Guest

    0
     
    Many thx Highland, I have been wondering how to do that :)

    Do you know if this rule can be set up in Plesk as a default for *all* new domains? I'm asking because I read somewhere that it is not recommended for SEO purposes to allow two access points (http & www) for websites.

    Also (and forgive me for asking but I am a complete Plesk VPS newbie) why does this work at all with an htaccess file?. Searching this forum, the advice seems to be to use vhost.conf files to set up mod_rewrite rules for domains?
     
  8. Highland

    Highland Guest

    0
     
    Unfortunately there's no way to do this by default that I know of. I suppose it's possible to write a script to do this but that's beyond my knowledge. It shouldn't be hard to edit this for each domain, tho.

    vhost.conf is used to configure how Apache sets up the TLD and how PHP is processed. htaccess is used to control how the domain is processed when requests are received. I don't think you can put mod_rewrite rules into vhost.conf
     
  9. Peekay@

    Peekay@ Guest

    0
     
    I just set up mod_rewrite for a dynamic site on a domain using htaccess without going near conf files. This really needs some clarification in the Plesk instructions IMHO 'cos it's a useful feature.
     
Loading...