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/p...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?