rewrite rules and domain pointing

Discussion in 'Installation/Configuration' started by simpim, Feb 17, 2011.

  1. simpim

    simpim New Member

    Im trying to do 2 tasks and im not sure if im on the right track.

    First i want mydomain.com to point to www.mydomain.com, so i created 2 websites in ISPConfig3.

    in the apache directives section for mydomain.com i enter this code;
    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^mydomain.com
    RewriteRule (.*) http://www.mydomain.com$1 [R=301,L]
    
    So far this works (i hope im doing this the correct way), it redirects to the www.mydomain.com

    The second part im trying to accomplish is pointing the www.mydomain.com to a directory within the root of the web folder but still only show www.mydomain.com. So when www.mydomain.com is loaded, its actually showing www.mydomain.com/directory. I tried using the redirect [R,L] and it seems to work but i lose some functionality, like the error pages dont work anymore.

    Any ideas on ways to get this done?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    The normal way of doing this is createing just one web site, mydomain.com, and then you select www. or *. in the Auto-Subdomain field.
     
  3. simpim

    simpim New Member

    This doesnt seem to fix the problem. I only want the www. to work and to redirect the non www to it. This is for SEO.
     

Share This Page