Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First, sorry for the shocking level of no-coding-skills. So what is probably best is that I describe what I want first.

I have 2 domain names, linking to one hosting package (yes, cheap-ass option, but anyway).

One of them - the original domain, which the code below is for - is based off of the root directory of my web hosting, the other is based in a folder called /getfilm/

The following was my .htaccess file before I got this new domain and set it up.

ErrorDocument 404 /404.html

RewriteEngine On
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
<ifmodule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !^/favicon\.ico [NC]
RewriteCond %{REQUEST_URI} favicon\.ico    [NC]
RewriteRule (.*) [R=301,L]

Now obviously this forces my new domain '', to change to ''. Which I obviously don't want.

I have no idea where to start, but can I possibly duplicate all of these actions to work with both '' at the root directory and '' above the root in /getfilm/ ?

share|improve this question

migrated from May 7 '11 at 10:45

This question came from our site for professional and enthusiast programmers.

If Apache is setup to have /getfilm (on your filesystem) be the DocumentRoot for the domain, then yes, you can simply create another .htaccess file and place it in this directory.

Note however, the Apache documentation recommends against using .htaccess files if you have access to the main server configuration file (you may not). In this case you could simply places your directives under the appropriate section.

See for more details and why Apache recommends against .htaccess if possible.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.