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

Im not familiar with apache2's rewrite engine so i need someone's help to create a rewrite rule. Im trying to redirect this folder's and its content's url:


share|improve this question
Just to be clear, you don't redirect a folder to a URL, you redirect the URL to a folder. It's important to understand the difference. – John Gardeniers Sep 5 '12 at 8:11
up vote 2 down vote accepted

I'll forgive your apparent lack of documentation-reading because the documentation for mod_rewrite is pretty unreadable. Thing is, you don't need mod_rewrite. (This is my favorite link for Server Fault.)

Much lighter and easier to understand if you just use mod_redirect:

Redirect /junk/

Also, you'll want to read the fine documentation on .htaccess files, particularly the part that says

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.

share|improve this answer
Hi, this is actually way better. Thanks – Adonis K. Oct 2 '12 at 18:00

You can use a simple .htaccess rewrite like:

RewriteEngine on
RewriteRule ^(.*)$$1 [R=301]

This should be placed under the .htaccess file located in the /junk directory of

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.