can you count the letter n in:
q: redirect issue with subfolder to subdomain on shared host heres the situation: i have a couple of different web projects running on a single shared host. project a is accessed through a subdomain (suba.mydomain.com) while project b is the main mydomain.com
both a and b are symlinks inside the hosts public_html folder:
ln -s /home/myhost/projecta ~/public_html/suba
ln -s /home/myhost/projectb ~/public_html/main

the subdomain (project a) works fine and the site is running on it.
for b which is the main domain, i have used .htaccess to point primary domain to a subfolder as written here. the domain website is also working fine.
the problem is when i do mydomain.com/suba, the subdomain website (project a) opens. i tried adding redirect rules to point mydomain.com/suba --> suba.mydomain.com like so:
rewritecond %{http_host} ^mydomain.com$ [or]
rewritecond %{http_host} ^www.mydomain.com$
rewriterule ^suba\/?$ http\:\/\/suba\.mydomain\.com\/ [r=301,l]

but the url still reads mydomain.com/suba and the website shown is project a (with images and static files missing obviously as its a different web project).
why isnt the redirect working?

a: unless you have a rewritebase / somewhere, ^suba\/?$ isnt going to match anything.  mod_rewrite looks at the entire url, including the leading /.  try:
rewriterule ^/suba/?$ http://suba.mydomain.com/ [r=301,l]

also, you can loosen up on the escaping.  it doesnt hurt, but it also doesnt help anything, and it makes it harder to read.

a: it seems the following line worked (and remove the earlier regex-heavy redirection code):
redirectmatch 301 /suba/ http://suba.mydomain.com/

thanks all!

a: request uri for mydomain.com/suba is /suba (note no trailing slash) which will not match
change your rewrite rule to
rewriterule ^suba http://suba.mydomain.com/ [r=301,l]

user
The given text has eighty-seven "n"s.
assistant