static to static url rewrite with htaccess with wordpress

I have a wordpress site with its own .htaccess automatically generated (because I’m using permalinks), than, my web-admin has configured apache to redirect any third level domain to my site, ie :

http://lol.example.com redirects to http://example.com

Read More

and than .htaccess with permalinks rules does the rest.
Now I want to write a rule in the .htaccess file that, when a user types a specific third level domain, redirects to a specific subfolder of my site, ie:

http://sprock.example.com/ redirects to http://example.com/mysprockfolder/

I know my question might sound weird, but I’ve never done this before so I’m quite confused.

Related posts

Leave a Reply

2 comments

  1. Solved with that regex in my .htaccess:

    Right before this comment (just in case you have WordPress installed):

    # BEGIN WordPress
    

    I’ve added the following:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?thirdlev.example.com [NC]
    RewriteRule ^(.*)$ http://example.com/myfolder/ [R=302,L]
    

    with a 302 redirect, everything is good!

  2. it would be much easier for you to just go to your ftp manager and make a subdomain forward to a link. Or, you can make a redirect using php.

    when redirecting make sure to add the http://www. or it will think you want to redirect to a part of your page on the site, also make sure that your subdomain has its own folder with its own files and images.