The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess to redirect domain.tld/subdomain to subdomain.domain.tld

Discussion in 'General Discussion' started by andreseso, Jan 25, 2006.

  1. andreseso

    andreseso Member

    Joined:
    May 20, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Using Cpanel I have set up the subdomain alejandro.cmp.es at directory http://cmp.es/alejandro

    I want all traffic directed to http://cmp.es/alejandro/url to be directed to http://alejandro.domain.tld/url

    I have tried with the following .htaccess file in the cmp.es public_html directory
    Code:
     
    RewriteEngine ON
    RewriteCond  %{HTTP_HOST} ^cmp.es
    RewriteCond %{REQUEST_URI} alejandro
    RewriteRule /alejandro/(.*) http://alejandro.cmp.es/$1  [R=301,L]
    
    RewriteCond  %{HTTP_HOST} ^www.cmp.es
    RewriteCond %{REQUEST_URI} alejandro
    RewriteRule /alejandro/(.*) http://alejandro.cmp.es/$1 [R=301,L]
    
    
    It redirects OK but the URL shown is http://alejandro.cmp.es//home/user/public_html/alejandro and I get the following 404 error:

    The requested URL //home/user/public_html/alejandro was not found on this server.

    This is done for Search Engine Optimization.

    Anybody know enogh mod_rewrite to make this work?
     
Loading...

Share This Page