How to properly write mod_rewrite or mod_alias rules for url forwarding

Posted on 2007-09-30
Last Modified: 2012-05-05
I have a domain (E.g. and I also write a blog on (E.g.

I'd like to use a mod_rewrite or mod_alias rule so that all requests for are rewritten internally to request  The user experience is that will always remain visible in the browser's URL bar, even though the internal links on the site point to

Can you please provide me with the mod_rewrite or mod_alias directives how to do that?  And please advise whether that goes in .htaccess, httpd.conf or php.ini.  My site is hosted in a shared environment at my ISP.

Question by:gmahler5th
    LVL 3

    Accepted Solution

    What you are asking can only be done trough mod_rewrite or mod_alias if both sites are hosted on the same server.

    To preserve your domain name in the address bar you should try frame forwarding. should return a page to the users that contains a frame with in this case.

    example html for frame redirect (place this in index.html or whatever your default document is)t:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">
    <title>My Personal Domain</title>
    <frameset rows="100%">
      <frame src="">
      Please follow <a href="">link</a>!

    If you really only want to achieve this trough apache alone you can try using mod_proxy but all the traffic will go trough your server and eat your bandwidth and your ISP might not be verry happy with that.

    Author Comment

    How would I configure the mod-proxy solution?
    LVL 3

    Assisted Solution

    these two directives must be placed into the virtual host definition of in httpd.conf. mod_proxy must be enabled.

    ProxyPass /
    ProxyPassReverse /

    This approach will not cache anything locally on your server and all the traffic will go trough your server.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now