How to configure apache (ubuntu) such that will direct to

I am a newbie to ubuntu and apache. Can someone tell me how I could direct to

when user address

Thanks a lot.



If you are running Apache and Ubuntu, there is actually a really easy way to force this redirect using a simple php script.

Create an index.php file in the root of your server and paste the following code into it

<?php header("location: drupal6/") ?>

This will cause the site to auto-redirect to the drupal6 folder whenever it is visited.

This should work. Create a file in the root folder of your server called .htaccess - the dot at the beginning is very important as this helps the server identify the file as a hidden / system config file.

Open the file and paste the following lines of code in :

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

This should force all traffic to the server to redirect to your custom folder.

A brief explanation of the .htaccess code

If you want rewrites to work, you have to enable the Rewrite Engine and tell the server to follow symlinks.

The second section establishes the rule - specifically applying it to all traffic on the standard web port of 80.

The final line tells the server to grab everything after the URL and append it to the new address (

There's a lot more you can do with .htaccess files but you really need to Google for good examples to test out.

Look at Apache's mod_rewrite documentation. You will need a RewriteRule in your apache configuration at the minimum, you may also need RewriteCond's to define when the RewriteRule is used.

Your rewrite pattern will be rewriting the REQUEST_URI with something from: ^/$ to: /drupal6. The ^ and $ are essential to prevent Apache getting into an infinite loop while rewriting the base URI by only matching "/" and not "/anything-else".

I assume you're on a recent version of Ubuntu and Apache? If so, see the Apache 2.2 documentation on mod_rewrite.

Need Your Help

Weird misalignment in my Susy layout

sass compass-sass susy-compass

The elements I set the Susy span-column() mixin to, do not obey to it. They are misaligned ever so slightly. How do I achieve perfect alignment of my HTML elements?

Flex - Label layout issue: shorter text means wider label

flex layout label width

Would anybody know why the following code results in the first label being wider than the second one? The first box (shorter text) measures 21 pixels in width, the second box 19 pixels.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.