Take the 2-minute tour ×

On our virtual host, we have defined our document root to point to var/www/something/public

Since we have that, do we need, on our .htaccess file (that will be placed on public directory btw), this?

RewriteRule .? /public%{REQUEST_URI}

Thanks in advance, MEM

share|improve this question
If my questions doesn't make sense, please let me know as well. :) –  MEM Mar 27 '11 at 11:12

1 Answer 1

up vote 1 down vote accepted

No. you don't need specify rewrite rules in .htaccess for this case.

Suppose you have a file named index.html in var/www/domain/public and you configured this directory as the DocumentRoot for 1sample1.com.

Then http://1sample1.com/index.html will work.

share|improve this answer
Correct me I'm wrong: I may need to specify rewrite rules in .htaccess files. But don't need this particular rule because it's redundant. Is that it? –  MEM Mar 27 '11 at 11:23
Actually you need not to worry about the folder name "public". Setting DocumentRoot means all files in DocumentRoot must serve for every http request. –  Suku Mar 27 '11 at 11:33
True, but If I need to redirect to a specific file, for example, for index.php especificly, and if I would like to avoid hotlinking on hosted images, for those both cases, I would need to have a rewrite rule, but the one on my question, that one, in particular, is redundant. Yes? - I'm just trying to make perfectly clear and be certain that I'm not making rules on my htaccess file that I don't need to. Hence all this questioning. :) –  MEM Mar 27 '11 at 11:37
Since you have already specified the document root to be the following /var/www/domain/public you dont have to explicitly write these rules in the .htaccess as both means the same. –  Suku Mar 27 '11 at 11:52
Thanks a lot. :) . –  MEM Apr 24 '11 at 17:25

Your Answer


