Forum Moderators: phranque

Message Too Old, No Replies

More complex .htaccess puzzle

More complex .htaccess puzzle

         

lkalisky

12:02 pm on Jan 29, 2007 (gmt 0)

10+ Year Member



I am trying to do away with an index page that is simply a meta-refresh to my home page, but I have a more complex situation with subdomains.

I would like to create an .htaccess that redirects like this:

domain.com >>>> www.domain.com/folderX/
www.domain.com >>>> www.domain.com/folderX/
subdomain1.domain.com >>>> subdomain1.domain.com/folderX/
subdomain2.domain.com >>>> subdomain2.domain.com/folderX/

... and so on.

My current index.htm does this by simply (meta) redirecting to ../folderX/index.htm. There must be a way to do away with this index.htm ile and handle the redirect with .htaccess. And that would be better for SEO, no?

Thanks in advance for any help.

jdMorgan

6:06 pm on Jan 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This project will be much simpler if you break it into its two constituent parts:

1) Redirect domain.com --> www.example.com
and
2) Rewrite
.. www.example.com --> www.domain.com/folderX/
.. subdomain1.example.com --> subdomain1.example.com/folderX/
.. subdomain2.example.com --> subdomain2.example.com/folderX/

The first step is to do an external 301-Moved permanently redirect from example.com to www.example.com.

The second step is to internally rewrite all domains to the /folderX/ subdirectory.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim