Tuesday, February 26, 2013

How to create a custom front page for Drupal 7 site using Views

Having installed Drupal, one of the first questions people ask is, ‘How do I change the home page?’ By default the front page of Drupal has a blog feel, with the latest posts shown in date order, but it does not have to be like this! These two articles will show how a front page can be customized using Views.

Video instructions are also provided at the bottom of the article.

Drupal’s default front page



The default Drupal front page is a blog style ‘teaser’ listing of the most recent posts, having followed these instructions the front page will consist of:
  • three article teasers, followed by;
  • ten more recent articles;
  • ten most commented articles;
  • recent comments in the sidebar (part two), and;
  • avatars of new users in the sidebar (part two).

Requirements

This article assumes a copy of Views is installed (and the Views UI module in particular).
For help with installing Drupal modules, see the Drupal documentation on installing modules.

Creating the page view

The first step is creating a page view that can be set as the front page. Click Structure -> Views which will show a list of currently available views, the module comes with some ready made ones, but this article will concentrate on making a new page view from scratch.
  1. Click Add new view,
  2. enter ‘Recent posts’ as the View name,
  3. set Items per page to 3,
  4. select the text in Create a page -> Page title and delete it (since there shouldn't be a title at the top of the view),
  5. click Continue & edit.
  6. Under Pager -> Use pager click Full,
  7. in the settings box that appears click Display a specified number of items,
  8. click Apply,
  9. click Apply on the next settings box that appears too.

Ten more recent articles

Creating the page view adds a page with three article teasers, next a table will be added beneath these showing ten more recent articles. Since the page already has the first three articles, the table will skip them and display the next ten.
  1. From the view edit page click Add, then Attachment from the drop-down menu,
  2. under Pager click 10 items,
  3. change the Offset to ‘3’,
  4. click Apply.
  5. Under Attachment settings -> Attach to: click Not defined,
  6. tick Page by clicking on it,
  7. click Apply,
  8. still in the same section, under Attachment position: click Before,
  9. in the settings box that appears, click After,
  10. click Apply.
  11. Under Format -> Format click Unformatted list,
  12. at the top of the box that appears is a drop-down labelled For, select ‘This attachment (override)’;
  13. select ‘Table’ from the option list,
  14. click Apply,
  15. click Apply on the next options box too.
  16. Under Fields click add,
  17. tick Content: Post date and User: Name,
  18. click Add and configure fields,
  19. when the Configure field: Content: Post date settings box appears:
    1. untick Place a colon after the label,
    2. click Apply;
  20. when the Configure field: User: Name settings box appears:
    1. untick Place a colon after the label,
    2. change the Label to ‘Author’,
    3. click Apply.
  21. Under Fields again, click the drop-down arrow next to add,
  22. from the drop-down list select sort by clicking on it,
  23. drag-and-drop the fields into this order: Content: TitleUser: Name then Content: Post date,
  24. click Apply.
  25. Under Display name: (near the top of the view page, on the left) click Attachment,
  26. in the box that appears enter ‘10 recent posts table’,
  27. click Apply.
Finally, when all required changes have been made, click Save.

Set the home page to the ‘Recent articles’ view

Click Configuration, then in the System section, click Site information.
In the Front page -> Default front page text box, enter ‘recent-posts’. Scroll to the bottom and click Save configuration.
This is what the new front page looks like so far:


Ten most commented posts

Following the ten recent articles table, a similar table can be added, showing the ten most commented-on posts. Since different fields from the existing view are needed a new view will be created.

Make the view

Create a basic block view
To get back to the Views interface click Structure -> Views (or by clicking the Views link from the breadcrumbs at the top — if already in the Views interface).
  1. Click Add new view,
  2. enter ‘Ten most commented’ as the View name,
  3. untick Create a page and tick Create a block instead,
  4. change Create a block -> Display format to ‘Table’,
  5. change Items per page to ‘10’,
  6. click Continue & edit.
This will add a new view of nodes ordered by date, some more work is required to make it show nodes ordered by comment count.
Customize the block view with comment counts
  1. From the view edit page, under Filter criteria click add,
  2. tick Content: Promoted to front page by clicking on it,
  3. click Add and configure filter criteria,
  4. in the settings box that appears, under Promoted to front page tick Yes,
  5. click Apply.
  6. Under Fields click add,
  7. tick Content: Comment count and User: Name by clicking on them,
  8. click Add and configure fields,
  9. when the Configure field: Content: Comment count settings box appears:
    1. untick Place a colon after the label,
    2. click Apply;
  10. when the Configure field: User: Name settings box appears:
    1. untick Place a colon after the label,
    2. change the Label to ‘Author’,
    3. click Apply.
  11. Under Fields again, click the drop-down arrow next to add,
  12. from the drop-down list select sort by clicking on it,
  13. drag-and-drop the fields into this order: Content: TitleUser: Name then Content: Comment count,
  14. click Apply.
  15. Under Sort criteria click add,
  16. in the field list that appears tick Content: Comment count,
  17. click Add and configure sort criteria,
  18. in the configuration box that appears check Sort descending,
  19. click Apply.
  20. Under Sort criteria again, click the drop-down arrow next to add,
  21. from the drop-down list select sort by clicking on it,
  22. drag-and-drop the fields into this order: Content: Comment count desc then Content: Post date desc,
  23. click Apply.
Finally, when all required changes have been made, click Save.

Position the most commented block

From the toolbar menu at the top, click Structure -> Blocks; from there the just created Ten most commented view may be positioned on the page.
  1. Scroll-down the table of blocks and find View: Ten most commented (under Disabled),
  2. in the Region drop-down select ‘Content’ (or the equivalent in your theme),
  3. scroll-up and find the Content region where the block has just been placed,
  4. if required, drag-and-drop the blocks into this order: Main page content then View: Ten most commented,
  5. scroll down and click Save blocks.
  6. Find View: Ten most commented in the block list again and click configure,
  7. under Show block on specific pages, click Only the listed pages, then enter ‘<front>’ in the text box below,
  8. click Save block.
The final table looks like:


Have a look at the new front page

From the toolbar menu at the top click the Home icon and admire the new front page!

Video instructions

Prefer following video instructions? Just watch the Youtube video below!


Conclusion

Views are one of the most versatile and useful modules available for Drupal, this article can only scratch the surface of what is possible. A good way to learn is by taking the views created here, then change them to do whatever is needed. It’s also worth noting that other modules for Drupal can integrate with views, providing more information.
Often a simpler site will not require views at all, using a static page is simple yet effective. Dynamic sites don't need to look dynamic, Drupal caters for this taste too.

Monday, February 25, 2013

What is Drupal components and how do they work?


Drupal Components are the things that make up the robust content management system and content management framework. Drupal Components mainly include node, modules and themes. In Drupal almost every content is a node.

1. Node

The main building block of Drupal is a node. The word ’node’ does not suggest that it is a part of some network. On the contrary, you should think of a node as a single puzzle piece that is placed onto the site by one of your users, or even yourself. A node can be part of a forum, a blog or a book, and by using the Content Construction Kit, you can create as many custom node types as you want. Remember that each node has a type, referred to as a Content Type. It also has a Node ID, a Title, a Body, a creation date, an author and some other properties. It is stored together with all other nodes in one big shoebox known as a "table" in your database.

Drupal has many tables, I think the core has some 50 of them. You may want to explore them on your own site to get a better idea.

Users have their own table too, and some of them are authors of nodes. So nodes do have relations. The only way to find those relations is by searching the whole table until you find all matching items. Luckily the database server is very fast.

Each node can have an unlimited number of comments. Comments are stored in a separate table. To find all comments on one node the server will search the entire comments table.

How do Nodes work?

Look at the address bar of your browser. It probably says "http://drupal.org/node/19828". This is the Drupal way of saying "Load all pertinent information for node 19828, including whatever relations (comments, users etc.) are to be shown". This is called a database query.

Most queries in Drupal are hard-coded in modules. /tracker searches all nodes and sorts the result by date. This also works for your site, as long as you enabled the tracker module.

When you hover over the menu and meanwhile read the links in the status bar you get a quick idea of possible queries. Because Drupal mimics a directory structure you maybe didn’t know it was a query until now!

Drupal modules perform a lot of operation on the data. For instance when you open a page which you have written yourself you see a view/edit tab on top of the page. This tab is not shown on other pages. This is automated behavior defined by the user privilege settings.

Drupal stores all of its content in nodes. Drupal’s basic set of node types is relatively short, but quite flexible.

Blog Entry

Blogs, or weblogs, are another term for an online journal or diary. They are a place where members of the community can write their own thoughts and not have to worry about being on topic for the site.

Book Page

Book pages are designed to be part of a collaborative book. An example of a collaborative book is the Drupal developer documentation. Originally only book pages could be a part of a book but these days all node types can be part of a book.

Comment

Comments actually aren’t nodes, they are their own special content type. Comments are what allow people to add comments to any other node that has been created.

Forum

Forums are sets of nodes and their comments. These are grouped together as belonging in one forum by assigning them the forum name, which is a taxonomy term. These forum names can be grouped in forum containers, which are other terms, of which they are children in a hierarchical vocabulary which is called "forums", and configured as only applicable to nodes of the "forum" type.

Page

Pages are simple nodes, typically used for static content that can (but are not required to) be linked into the main navigation bar

Poll

A poll is where a multiple choice question is asked and users can answer and see other people’s answers to questions.

Story

Story pages are the generic page type that most content management systems have. Stories are generally used for information which is only relevant for a period of time (eg. news stories) and is expected to expire off of the page. Additional types of nodes are provided by contributed modules.

Note: A common question is "What is the difference between page and story?" The answer is not much. There was more difference originally but they are merely different node types now and how you use them is up to you.

2. Content

Once you have logged-in, you’re ready to start posting content. At the top of your personal menu, you’ll find a link called "create content". Click this and you’ll see a list of the types of content you can create. This list reflects the privileges assigned to your user account or to the group ("role") your account is part of.

There are several contributed modules which can assist with more complex content creation within this framework, such as spell checking, image embedding, and file attachment uploading.

2.1 Page

The page module allows users to create static pages, which are the most basic type of content.

Pages can be collected in books via the book module. Users should create a page if the information on the page is static. An example would be an "about" page.

When a page is created, a user can set authoring information, configure publishing options, whether readers will be able to post comments. They can also select the content type of the page (e.g., full HTML, filtered HTML, php).

As an administrator, you can set the publishing default for a page (in its workflow): you can specify whether a page is by default published, sent to moderation, promoted to the front page, sticky at the top of lists, and whether revisions are enabled by default. You can set the permissions that different user roles have to view, create, and edit pages.

2.2 Story

The page module allows users to create static pages, which are the most basic type of content.

Pages can be collected in books via the book module. Users should create a page if the information on the page is static. An example would be an "about" page.

When a page is created, a user can set authoring information, configure publishing options, whether readers will be able to post comments. They can also select the content type of the page (e.g., full HTML, filtered HTML, php).

As an administrator, you can set the publishing default for a page (in its workflow): you can specify whether a page is by default published, sent to moderation, promoted to the front page, sticky at the top of lists, and whether revisions are enabled by default. You can set the permissions that different user roles have to view, create, and edit pages.

3. Menu and Menu System

Menu’s are displayed in blocks. Blocks are the columns at the left and/or right site of your web page. First be sure to enable the menu module (blocks module is always enabled). You will get a menu item in the admin menu.

All modules come with default menu items. Often you only will need to enable them. You can change its location in the menu tree by setting its parent and you can change its title if you wish. In all cases it will only show up when you have rights to view the content. E.g. the admin item is not shown to visitors.

You can also create custom items (add menu item tab). You will need to provide a path to the content. Go to the page you want to link to (e.g. via recent posts) and look at the address bar.

By default the address next to the domain name will begin with ’?q=’. When ’clean URLs’ is enabled you will see a directory structure. Anyway, you need to copy-paste the right part of the address without the domain name and without the "?q=". This is called the local or relative path. (But as I mentioned, it’s a database query mimicking a directory structure.)

By the way, if you change your settings to ’clean URLs’ you may also want to change the "default front page". That can be your forum main page ’forum’ or a custom made page ’node/15’.

’Navigation’ is the default menu, but you can create more as you like. You will need to activate a menu in the blocks settings to tell if, and also where, you want those menu to be displayed. Next you can move menu items to it by changing the item’s parent property.

You also can create custom blocks. You can type the html code yourself so you have complete freedom.

You will soon discover the menu’s and blocks will not give you all you need. The main problem is that a menu item can point to a single node or to a list of nodes of one type, organized by date. In other words, you only can create links that have a fixed meaning, defined by the modules. And you want more of course! For that reason you will need modules that create structure. Examples are:

- books
- stories
- search
- taxonomy
- archive

4. Themes

Drupal takes great care to keep the elements of content and its presentation of a site separate.

This allows you to come up with multiple designs for the same content. These designs are called themes. Each theme can consist of one or more files that work together to present the content of your site in a unique way. Drupal has four themes available as part of the core download, and many more available in the contributions repository on Drupal.org.

To see themes in action, navigate to Administer >> Site Building >> Themes or to Appearance (Drupal 7, later).  This page presents a list of all the installed themes. You can enable them individually by checking the Enabled check box, and you can choose one to be the default theme. Drupal allows registered users to choose which theme to use from among the enabled themes. That user will then experience the site in the theme of their choice. If you want your site to be viewed in only one theme at all times, leave only one theme enabled.

5. Modules

A fresh installation of Drupal has only a small fraction of the available functionality enabled.

The most common way to enhance Drupal and add functionality is through modules. Drupal comes with more than 30 modules installed, but most of them are disabled by default.

To see a list of available modules, navigate to Administer >> Site Building >> Modules or to Modules (Drupal 7, later). All of the modules listed on this page correspond to individual files in the /modules directory in your Drupal installation. You can enable them simply by checking the Enable check box and clicking Save Configuration.

5.1 Blog

The blog module allows registered users to maintain an online weblog (commonly known as a blog), often referred to as an online journal or diary. Blogs are made up of individual posts that are time stamped and are typically viewed by date as you would a diary. Blogs often contain links to webpages users have read and/or agree/disagree with.

To get started with the Blog module, you need to assign the Edit Own Blog permission to the user roles that should be able to maintain individual blogs. Users with the proper permissions can then create new blog entries using the Create content >> Personal blog entry link. You can categorize blog using the taxonomy module. Additionally, blogs can have file uploads, store revision history, be promoted to the front page, and have comments.

5.2 Poll

The poll module lets you create simple polls. You ask a question, provide possible answers, and let your users vote. All votes are counted, and the running results can be seen represented as a bar graph.

To create a poll, activate the Poll module and go to node/add/poll. Give your poll a title that explains it, and then enter a number of choices. You can set the initial votes to something other than zero, if you have a reason to do so. If you need more than five choices, check the Need More Choices box and then click Preview. You will be given five more choice fields. The Poll Duration field lets you set a time frame for the poll to be open to voting, after which the poll will be closed and voting will no longer be possible.

On the access control page (Administer >> Access control) (or People >> Permissions for Drupal 7) you can decide which users have permission to vote, to see the voting results, and to create polls of their own.

6. Blocks

A block is a unit of content that you can place in the various regions of the layout. Blocks can do many different things. The login fields and the main navigation menu are each blocks, for example.

To see the list of available blocks, navigate to Administer >> Site Building >> Blocks or to Structure >> Blocks (Drupal 7, later). The table on the blocks page lists all of the available blocks by region, or under Disabled for those blocks that are not yet turned on. You can enable any of the disabled blocks by checking the Enabled check box and clicking Save Blocks. You can also change the region of the screen where they appear. You have the choice of right or left sidebar, header, footer, or content.

Blocks are generally provided by modules, which means that as you enable or install more modules, more blocks will be available.

An administrator defined block contains content supplied by the administrator. Each admindefined block consists of a title, a description, and a body which can be as long as you wish.

The Drupal engine will render the content of the block.

Where can Drupal be used?


Here are some of the types of people who use Drupal, along with the features they may want and the skills they're likely to have. If the features meet your needs and you have the right level of skills, Drupal may be a perfect system for you.

I'm a Blogger and I need...

  • Single-user or multi-user blogs (or both)
  • Ways to assign categories to my content
  • Commenting
  • Trackbacks
  • Themes I can use to customize the style and layout of my site
  • Support for images or other media, using contributed modules (plug-ins)

Skills needed: end-user, administrator

I'm evaluating Drupal for my organization or company and we need...

  • Customizable user roles and permissions
  • Robust security
  • Scalability
  • Functionality we can configure and extend to meet specific business needs
  • A support infrastructure (documentation, community, etc.)
  • Ways to assign categories to our content
  • Additional features or functionality

Skills needed: evaluator, end-user

I'm a community organizer and I need...

  • Ways for community members to easily share ideas (blogs, forum, files, etc.)
  • Tools members can use to self-organize
  • The ability to evolve as the community evolves (keeping up with the state of the art for interactive web sites)
  • A support infrastructure (documentation, community, etc.)
  • Customizable user roles and permissions
  • Safety and security on the web (control over spam, trolls, etc.)
  • Preconfigured tools for community-relationship management like CivicSpace.

Skills needed: evaluator, end-user, administrator, site developer (to some extent)

I'm a small-business owner and I need...

  • A site I can set up myself
  • Themes I can use to customize the style and layout of my site
  • Customizable user roles and permissions
  • Scalability and adaptability to the needs of my changing business
  • Ways to to categorize my content
  • A support infrastructure (documentation, community, etc.)
  • E-commerce support for
  • Shopping carts
  • Premium paid-content subscriptions
  • Functionality I can configure and extend to meet specific business needs

Skills needed: evaluator, end-user, administrator, site developer (to a limited extent)

I build or design websites for clients and I need...

  • The freedom to create a custom look and feel with my own themes
  • Additional features and functionality
  • Easy-to-provide support for my clients
  • Access to a community of designers and developers

Skills needed: evaluator, administrator, site developer, developer (to some extent)

I'm a programmer and I need...

  • A robust, well-designed, modular system I can customize and extend
  • Well-documented APIs
  • System and architecture documentation and coding standards
  • Access to a community of other developers
  • A rich list of features

Skills needed: administrator, programmer

Do you know what type of Drupal user you want to be? If you do, review the skill sets below to see what you'll need to get started:

Evaluator: Be familiar with web terminology and concepts.

End-user: Be familiar with browsing, clicking, submitting web pages, selecting options.

Administrator: Manage roles, select themes, categorize web pages (content), configure module settings, install and upgrade software and databases, apply security fixes.

Site designer/developer: Install software, design style and layout (with css and minimal php), build and deploy websites, evaluate contributed modules, work with LAMP.

Programmer: Program in php, administer databases, program through a well-defined API, design database objects, evaluate existing solutions, apply patches, collaborate with other developers.

Now is a good time to learn more about Drupal. The Case studies section examines typical types of sites that use Drupal and gives links to real sites of each type. This section includes a listing of hundreds of Drupal sites.

In the Feature overview we survey some of the most important and commonly deployed features of Drupal.

Why choose Drupal for your web application or website?

Here are some of the reasons why you should choose drupal for developing your web
application or website:
  1. Easy to install
  2. Easy to use - no programming knowledge needed! Spend 2 hours administering your site. After that you will feel very familiar with Drupal
  3. Evidently user friendly and easy to learn
  4. Lots of features, such as custom search engine friendly URLs(SEF), categories, search function, RSS, easy administration
  5. Lots of modules to add even more functionality to your site
  6. Flexibility - you can easily turn your drupal installation into a forum, faq, blog, wiki and many other types of web sites.
  7. Free to use, open source. You can freely install drupal and you can modify the source code to fit your needs, if you want.
  8. Lots of users & community - easy to find solutions to your problems. The large community guarantees that Drupal will have a bright future.
  9. Lots of themes, you will find one theme that will suite your websites content at the official Drupal website that also for free.
  10. Well documented updates and modules, not that difficult to code own modules and themes as well.
Except of the modules you can download at drupal.org, Drupal originally ships with modules that facilitate:
  • Post, revise, and categorize content
  • Conduct searches
  • Post comments
  • Take part in forums
  • Vote in polls
  • Work on collaborative writing projects
  • Post and view personal profiles
  • Communicate among themselves or with the managers of a site
  • Change the look of a site with off-the-shelf or custom-made themes
  • Build multi-level menus
  • Provide users with an interface in their local language
  • Provide RSS feeds
  • Gather content from the RSS feeds of other sites
  • Register and manage user accounts
  • Assign fine-grained user roles, granting users permission to use selected features of a site
  • Use access rules to deny site access to specified usernames, e-mail addresses, and IP addresses
  • Provide statistics and reports for administrators
  • Manage caching and throttling to improve how a site performs in heavy traffic
  • Construct and specify various input filters and content types
  • Generate user-friendly, easy-to-remember URLs
Statistics Speak




The above statistics will give you a better idea why to use Drupal. Absolutely it is one of the best open source free CMS available.

Wednesday, February 20, 2013

How to install a Drupal site in 6 steps


To install and run Drupal your web host must meet certain minimum requirements. Most web hosts meet these requirements. However, a few stand out by also supporting the Drupal community. If you need a host, consider selecting one of our reviewed web hosts.

Introduction to installation

Drupal provides an installation script that automatically populates database tables and configures the correct settings in the settings.php file. This section covers preparing for installation, running the installation script itself, and the steps that should be done after running the installation script has completed. It also explains how to do a "multi site" installation, where a number of different Drupal sites run off the same code base.

Before proceeding with your first Drupal installation, you should also review the best practicessection. For help with Drupal terms, see the glossary page.

Other tools

Some of the steps in the installation process can be performed with tools such as graphical applications for moving files and managing databases or tools that are provided by your hosting service. This documentation focuses on performing tasks at the command line. For information on using other tools, see the documentation that accompanies the application or is provided by your hosting service.

Creating a test site on a local computer

It is considered a good practice to do all development work on a separate test site before making changes to a production site. A test site allows you to evaluate the impact of upgrades, new modules, modifications to themes etc. without causing disruption to your live site. For information about setting up a web server on a local computer, see the Local Server Setupsection of the Developing for Drupal guide.
Alternative methods for installation

Some web hosting companies offer "one-click" installations of Drupal, or specific Drupal support. You may be able to locate one on the Drupal hosting page (these hosting companies also support the Drupal project).

There is also information about Drupal distributions, which include installation profiles and pre-packaged distributions of Drupal and modules. These may be of help as well.

System requirements 

About hosting

To install and run Drupal your web host must meet certain minimum requirements. Most web hosts meet these requirements. However, a few stand out by also supporting the Drupal community. If you need a host, consider selecting one of our reviewed web hosts.

Drupal's minimum requirements

Disk space

15 Megabytes for a minimum base installation, 60 MB with many contributed modules and themes, and more for database content, media, backups and other files. Web server

Apache, Nginx, or Microsoft IIS

Unfortunately Drupal still does not work properly on some systems running Ubuntu. Database server

Drupal 6: MySQL 4.1 or higher, PostgreSQL 7.1,

Drupal 7: MySQL 5.0.15 or higher with PDO, PostgreSQL 8.3 or higher with PDO, SQLite 3.3.7 or higher

Note: Microsoft SQL Server and Oracle are supported by an additional module PHP

Drupal 6: PHP 4.4.0 or higher (5.3 recommended)

Drupal 7: PHP 5.2.5 or higher (5.3 recommended)--some of the modules require 5.3

Drupal 8: PHP 5.3.10 or higher


Drupal 8 can no longer be installed on hosts with the 'magic_quotes_gpc' or 'magic_quotes_runtime' PHP ini settings turned on; these setting are deprecated in PHP 5.3 and have no effect anymore in PHP 5.4.


Note: if you meet these requirements but still have problems with your site, be sure to read through the Webhosting Troubleshooting FAQ.

Step 1: Download and extract Drupal


Drupal is available in two supported versions (the most recent and the previous). The "recommended release" is the latest stable release of that version. To learn more about versions, see the Drupal version information page.


If you would like to create a Drupal site in a language other than English, information about Drupal translations is available at http://drupal.org/project/translations.

Downloading Drupal


Before you begin, log into your server and navigate to the directory from which you will be serving your Drupal site. On many *nix computers the path from the server's root will be /var/www/html, so cd /var/www/html. On a shared server, or a server that hosts multiple domains, the path will be different (try cd ~/www or cd ~/public_html). If you are unsure of the directory, ask your hosting provider for assistance.


Download Drupal using any download utility, the two most popular of which are wget and curl. Not every computer has both. The commands are, respectively:


wget http://ftp.drupal.org/files/projects/drupal-x.x.tar.gz

or

curl -O http://drupal.org/files/projects/drupal-x.x.tar.gz


(Note that the option for the curl command is the upper case letter "O" and not the numeral that stands for zero.)


(Replace the "http://drupal.org/files/projects/drupal-x.x.tar.gz" string with the link for the version you will be installing.)

Extracting Drupal


Type the following command (replacing "x.x" with your downloaded version's number):


tar -xzvf drupal-x.x.tar.gz


Remove the compressed version of the file by typing rm drupal-x.x.tar.gz.
Moving Drupal to its intended location


Now you need to move the contents of the drupal-x.x directory one level "up" into the web server's document root or your public HTML directory:


mv drupal-x.x/* drupal-x.x/.htaccess ./


For Drupal 7 also add mv drupal-x.x/.gitignore ./


The files from the directory you downloaded and decompressed have now been moved up a level into your web directory, and you can delete the drupal-x.x directory (which is now empty):


rmdir drupal-x.x

Before continuing to the next page ...


The base URL for your Drupal installation will be set in your web server's configuration file. You will need to know this URL before proceeding to the next steps of the installation. If you are installing Drupal on your local machine the base URL may be: http://localhost. If you are installing Drupal to a web server your base URL may be a specific domain name (such as http://example.com).

Step 2: Create the database


Note: Since 8.x, Drupal can create the database itself if its database user has enough privileges. See the relevant change notice.


Before running the installation script, you must create an empty database and database user (a user name assigned the rights to use the Drupal database).


This page offers guidance for creating your Drupal database using a web browser-based control panel (such as "CPanel" or "Plesk"), or by using phpMyAdmin (another browser-based database utility), or by creating the database directly from the MySQL or PostgreSQL command prompt (for more advanced users).

Create a database and user via a browser-based control panel


Most web hosting accounts provide a Web-based control panel to help you administer your site. These tools include easy-to-use features for creating a new database, and for creating a "user" with rights to the database. To create a database using a browser-based control panel consult the documentation or ask your web host service provider.


When you create the user for your database, you may see a page where you can specify the privileges that user will have for various operations on the database. In most web control panels' "database wizard", if you simply check "All" privileges for the user you create (and then uncheck "Grant" if it is listed as a privilege) your user will be set up correctly.


Take note of the username, password, database name and hostname (eg. are you installing in http://example.com, or in http://drupal.example.com, or http://example.com/blog etc.) as you create the database. You will enter these items into fields in your browser when running the install script (see next page).


Note that in many cases when creating databases and users via a web-based interface, the username you use to log into your control panel is added as a prefix to the database name and possibly to the database username as well. For example, if you log into your site's control panel as "webadmin" and create a database named "drupal7db" and a user for that database named "d7user", when running the Install script (see next page) the database and user may need to be typed in as "webadmin_drupal7db" and "webadmin_d7user". (This is because many hosting accounts are on shared servers, and on one server each database and user name must be unique across all accounts on the server.)


If you have created your database and user via a web-based interface, you can skip the remainder of this page and continue with the install instructions on the next page.


Create a database and user using phpMyAdmin


This presumes you have root access to phpMyAdmin
  1. Log in to phpMyAdmin as the root user. 
  2. Click Privileges and Add a new User OR you can use root user credential as well.. 
  3. In the User name field, enter the username you wish to use. 
  4. In the Host field, select Local which is more secure, unless you will be accessing the database with this user from another server. 
  5. Enter or generate a password for the user. 
  6. In the Database for User list, select Create database with same name and grant all privileges and click Go. 

You have now created a user that has all privileges only on the database with the same name. This is more secure than using a general username and password for all your sites on the same server, as it limits access to your databases if someone gets hold of your database logins.


If you want to have a different name for database and user, just select the created database, then click the operations tab. You will find an option Rename database to. If you need more details about using PHPMyAdmin, check out the official wiki.


Take note of the username, password, database name and hostname (eg. are you installing in http://example.com, or in http://drupal.example.com, or http://example.com/blog etc.) as you create the database. You will enter these items into fields in your browser when running the install script.


Note that in many cases when creating databases and users using a web interface, the username you use to log in to your control panel is added as a prefix to the database name and possibly to the database username as well. For example, if you log into your site's control panel as "webadmin" and create a database named "drupal7db" and a user for that database named "d7user", when running the Install script (see next page) the database and user may need to be typed in as "webadmin_drupal7db" and "webadmin_d7user". (This is because many hosting accounts are on shared servers, and on one server each database and username must be unique across all accounts on the server.)


If you have created your database and user via phpMyAdmin, you can skip the remainder of this page and continue with the install instructions on the next page.


Create a database from the command line


If you do not use a Web control panel or are experienced with and prefer to use MySQL or PostgreSQL commands, you can follow the information below.


Additional information about privileges, and instructions to create a database using the command line are available in INSTALL.mysql.txt (for MySQL) or INSTALL.pgsql.txt (for PostgreSQL).

Create a database using MySQL commands


The database should be created with UTF-8 (Unicode) encoding, for example utf8_general_ci.


For information on installing and configuring MySQL see http://dev.mysql.com/tech-resources/articles/mysql_intro.html


In the following examples, 'username' is an example MySQL user who will have the CREATE and GRANT privileges and 'databasename' is the name of the new database Use the appropriate names for your system.
Create a new database for your site.

mysqladmin -u username -p create databasename


MySQL prompts for the 'username' database password, and creates the initial database files.
Log in and set the access database rights:

mysql -u username -p

MySQL prompts for the 'username' database password.
At the MySQL prompt, set the permissions using the following command:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON `databasename`.* TO 'username'@'localhost' IDENTIFIED BY 'password';

In this case:
'databasename' is the name of your database
'username@localhost' is the username of your MySQL account
'password' is the password required for that username

You will need the ` around the database name if you have used a MySQL escape character in your schema name.

Eg: drupal_test_account.* should be drupal\_test\_account.* for security (underscore is a wildcard). This requires the ` wrapper. `drupal\_test\_account`.*

Note: unless your database user has all of the privileges listed above, you will not be able to run Drupal.
If successful, MySQL will reply with:

Query OK, 0 rows affected
To activate the new permissions, enter the following command:

FLUSH PRIVILEGES;
Now exit the MYSQL prompt by typing:
exit
The server will answer by saying
Bye 


Create a database using PostgreSQL

The database must be created with UTF-8 (Unicode) encoding. 

Create a database user

This step is only necessary if you don't already have a user setup (e.g. by your host) or you want to create new user for use with Drupal only. The following command creates a new user named 'username' (you should substitute this with the desired username), and prompts for a password for that user:

createuser --pwprompt --encrypted --no-adduser
--no-createdb username

If everything works correctly, you'll see a CREATE USER notice. 

Create the database

This step is only necessary if you don't already have a database setup (e.g. by your host) or you want to create new database for use with Drupal only. The following command creates a new database named "databasename" (you should substitute this with the desired database name), which is owned by previously created "username":

createdb --encoding=UNICODE --owner=username databasename

If everything works correctly, you'll see a CREATE DATABASE notice. 

Step 3: The settings.php file 


Prior to running the installation script, you must create a settings.php file and set some permissions.
Settings.php


Your Drupal download comes with a sample configuration file at sites/default /default.settings.php. The default file must be copied and the new file must be given the correct name, settings.php.


Please note: With Drupal 7.x, on some types of shared/local hosting, if PHP and Apache are run by the same user, Drupal will attempt to execute the first three steps for you. If you get errors referring to the "Settings file" during installation, you can perform these steps manually.
Copy the default.settings.php to settings.php.
Do this from the command line (working from the root of the directory containing your Drupal installation) by typing

cp sites/default/default.settings.php sites/default/settings.php.

Please note: Do not simply rename the file. The Drupal installer needs both files.
You should now have a default.settings.php AND a settings.php file in your sites/defaultdirectory.
Make the settings file writeable, so that the installer can edit it, type
chmod a+w sites/default/settings.php or
chmod 666 sites/default/settings.php

Both commands have the same effect.

Several FTP tools like Filezilla, Transmit, and Fetch allow you to change file permissions, using a 'file attribute' or 'get info' command. In this case the file permission should be set to 666. If your FTP client has checkboxes for setting permissions, check both the Read and Write boxes for "Owner", "Group", and "Others" (but leave the Execute boxes unchecked).
Please note: Do not forget to change permissions back after you have run the installation script. Those permissions should be:


chmod 644 settings.php
chmod 755 ../default 

To let the files directory be created automatically, give the web server write privileges to the sites/default directory.


chmod a+w sites/default

Step 4: Run the installation script 


For Drupal 7

To run the Drupal install script, point your browser to the base URL of your web site.
The "base URL" means the document root (directory) where you placed your Drupal files (and is defined in your web server configuration file). If you have installed Drupal on a web host this will likely be a domain name such as http://www.example.com. If you installed Drupal in a subfolder, then you should point your browser to the subfolder (e.g. http://example.com/subfolder). If you have installed Drupal on your desktop machine this URL might be http://localhost/drupal.


If the installation process does not simply appear by entering the base URL of your site, add the file name "install.php" (for example http://www.example.com/install.php).


You will be guided through several screens:
Choose which profile to use for the installation (standard or minimal).
Most people should select the "standard" option. The standard option comes with default content types already enabled, such as Article and Page, and with appropriate publishing options already set. (Of course you can later edit these default content types and their settings, or add additional ones.) The standard profile also has a useful collection of modules pre-enabled for you.


The "minimal" option is targeted toward more experienced Drupal site creators who wish to set up their own content types with associated publishing options. The minimal profile has only three modules enabled: Block, Database logging, and Update status.



Select a language
If you want to install using a language other than the default English, click the Learn how to install Drupal in other languages link.



Verify requirements
If your installation directory is not yet configured properly, you will be informed at this step. You can correct the settings individually and either refresh the browser screen or click 'Try again' to see whether there are any errors left.





Possible errors include:
Missing directories and/or incorrect permissions
The installer will attempt to automatically set up a number of directories, but this may fail due to permission settings. In this case you will find the missing directories listed.
sites/default/files
sites/default/private
sites/default/private/files


These directories should be set to the following permissions chmod o+w sites/default/files OR chmod 777 sites/default/files
Missing settings.php or incorrect permissions
If settings.php is missing or not accessible, follow the instructions in Step 3: The settings.php file. Note that you will need both the default.settings.php and settings.php files.
Set up database
Enter the database name as well as the username and password for the database that you created in Step 2: Create the database. This username and password information allows Drupal to access your database, so the install script can create tables. Note that this is notthe username and password for administering Drupal; these will be created in the next step.





The Advanced options will allow you to change the database host ('localhost' is usually used in this entry: wamp/bin/apache/Apache2.2.11/bin/php.ini as an example of the location on a Windows box running WAMP). You can also change the port and the table prefix. You only need to change the port if you are using a non-standard port number. The table prefix is useful if you are installing multiple instances of Drupal tables that share the same database.


Click Save and continue at the bottom of the page. 

Install profile

A progress bar will appear and display notes from the installer regarding the progress of the installation. If no errors are encountered, the next page will automatically load in your browser.



Configure site

Input the information for the first user account (which will be automatically assigned full administration permissions) and provide basic web site settings.
In the Site name field enter the name you wish to use for the site. You can also edit it later through the administration interface.
In the Site e-mail address field, enter the e-mail address that will be used by Drupal when it sends out notifications such as registration information.
In the Site maintenance account field, enter the Username, E-mail address, andpassword for the main administration account.


Note that there is a distinction, as of Drupal 7, between the main administration account that you set up on this page, and the "Administrator" site administrator user role that you will see when you visit the "Roles" and "Permissions" pages in the administration interface. The account you set up in the Site maintenance account section during installation is a super-user who has overall control over every aspect of the management and configuration of the site. (This will be http://www.example.com/user/1, for those of you familiar with that account from earlier versions of Drupal.)


In the Server settings field, select your Default country and Default time zone.
In the Update notifications field leave both boxes checked if you want your Drupal server to alert you when updates are required. Often updates relate to security issues and are important to perform. However, if you have restricted Internet connectivity (for example if you are behind a corporate firewall) you may want to leave these settings unchecked and test them later.



Click "Save and continue". On success you will see the Drupal installation complete screen. If there are any error messages, review and correct them now.


Secure your site


After the installation is complete, you will want to change the permissions on the settings.php file back so that it is protected:


chmod u=rw,o=r,a=r sites/default/settings.php OR chmod 644 sites/default/settings.php


If you make manual changes to the settings.php file later, be sure to protect it again after making your modifications.


Failure to remove write permissions to that file is a security risk. (Although the default location for the settings.php file is at sites/default/settings.php, it may be in another location if you use the multi-site setup.)

Step 5: Set up cron


Configuring cron is an extremely important task in your Drupal website setup. Search module's indexing of your website's content, Aggregator module's retrieval of feeds, Ping module's notification of other sites of updates, and System module's routine maintenance tasks, such as pruning of logs, all depend on a properly configured cron job.

What is a cron job?


Many Drupal modules have tasks that have to take place from time to time. Think of cron as the tolling of a bell, letting Drupal know that it should perform the appropriate tasks.


The actual "cron job" is a time-triggered action that is usually (and most efficiently) performed by your website's hosting server, but can also be configured by a remote service or even from your own desktop.


For your Drupal site, what actually happens is that the cron job triggers an invisible visit to the site's cron.php file (http://www.example.com/cron.php) which, in turn, executes tasks on behalf of installed modules. [Note: In Drupal 7, the direct path to cron is obscured by a key (to prevent unauthorized bots from hammering your cron). The exact path to your site's cron file – e.g.,http://example.com/cron.php?cron_key=hW309d0DD2Qw4_4NXXnUW7q3SFCQfPP8v11... – is displayed in your site's Status Report.]

Triggering Drupal cron without a cron job


With the inclusion of "Poor man's cron" in the Drupal 7 core, it is no longer necessary to set up a cron job on your web server. Instead, you can configure the frequency with which cron is run on admin/config/system/cron (Administration > Configuration > System > Cron). Cron will then be triggered by end users visiting your site. (You can also disable this functionality entirely for performance here, by setting the "Run cron every" value to "Never" or setting $conf['cron_safe_threshold'] = 0 in settings.php.)


In Drupal 6, you can achieve the same functionality by installing the contributed Poormanscron module.

Step 6: Clean URLs


By default, Drupal uses and generates URLs for your site's pages that look like "http://www.example.com/?q=node/83." This style of URLs can be hard to read, and can prevent some search engines from indexing all the pages of your site. Research suggests this may not be as big of a problem for major search engines as it once was; however, it is worth noting the recommendation from Google's webmaster guidelines stating:


If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.


If you are unhappy with the default URLs in Drupal, you may be able to tell Drupal to use "clean URLs", eliminating the "?q=" in your site's URLs, and this page explains how to do it. The instructions below are largely applicable only for the most common server setup, which is an Apache web server running on some flavor of Unix/Linux, with the mod_rewrite Apache moduleconfigured and mod_rewrite enabled in httpd.conf configuration file. If you are running Drupal on a different type of server, check the links section below (just above the Comments section of this page) to see if there might be something that addresses your server configuration on a different page.


Before enabling clean URLs in the Drupal configuration screens (see below), you may need to prepare your server for clean URLs to work. There are two ways to prepare your server for clean URLs to work in Drupal. If you have complete control of your server, for example because you run your own server, are installing a development site on your personal computer, or have a dedicated server hosting account, then you should enable clean URLs in the httpd.conf file for better performance and security. However, if you have a shared hosting account (at DreamHost, BlueHost, HostGator, GoDaddy, 1and1, et al.), you will not be able to modify the httpd.conf file and should use the Drupal .htaccess file instead.
Clean-Urls Test - False Negatives


On some setups the Clean Urls test gives a false negative result. If you can visit Clean Url links like http://example.com/user/login and Drupal returns the user login page, .htaccess and mod_rewrite are working. Visiting the Clean Urls admin page directly at http://example.com/admin/config/search/clean-urls, should give you a checkbox that lets you enable Clean Urls. See http://drupal.org/node/1178850. Note: If Clean Urls like http://example.com/user/login. stops working (switching hosts) you can visit the same page by changing the URL to look like: http://www.example.com/?q=user/login.
Enabling Clean URLs in Drupal


Note: The standard Drupal installation contains a sample .htaccess file which supports clean URLs. It is easy to miss copying this file, because of the leading "dot". So before trying to enable Clean URLs, make sure this file exists in your Drupal installation.
Drupal 7.x


In Drupal 7, the installer tests for compatibility with Clean URLs as a part of the installation process. If the environment is tested as compatible with Clean URLs, it will be enabled as part of the installation process and no further action is required to enable Clean URLs.


If you need to enable Clean URLs post installation, Drupal will run the clean URL test automatically when you navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata), show the results, and allow you to save configuration.


You can enable or disable it at a later time by following these steps:
Navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata)
Wait for the automated Clean URLs test to run.
Check or uncheck the Enable clean URLs checkbox
Click "Save configuration"


Even if Clean URLs are successfully enabled at install-time, if you have a dedicated server you may still want to follow the steps (below) to enable the more efficient httpd.conf rewrite method for clean URLs. If you choose to do that, you might want to turn off Clean URLs while you are working on the server.
Drupal 6.x


In Drupal 6, the installer tests for compatibility with Clean URLs as a part of the installation process. If the installer was not able to run the test successfully at install time, you can later follow the instructions below for Drupal 5 to get Clean URLs working. There is one minor difference: Drupal 6 will run the clean URL test automatically when you navigate to the Clean URLs configuration page and will show the results, in place of giving you a link to run the test manually.


Also note that even if Clean URLs are successfully enabled at install-time, if you have a dedicated server you may still want to follow the steps (below) to enable the more efficient httpd.conf rewrite method for clean URLs. If you choose to do that, you might want to turn off Clean URLs while you are working on the server.
Drupal 5.x


Here are the steps necessary to enable Clean URLs in Drupal 5: 

Go to the Clean URL's (Administer > Site configuration > Clean URLs in Drupal 5) section of the administrative interface.
Look for the paragraph that reads as follows:


This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL.) Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The handbook page on Clean URLs has additional troubleshooting information. Run the clean URL test.
Click on the Run the clean URL test link at the end of the above paragraph.
If the test is successful, set Clean URLs to "enabled" and save the configuration. If the test is not successful, use the steps below to fix your server configuration and try again.
Prior to Drupal 5.x


For Drupal versions prior to Drupal 5, there is no automatic Clean URLs test or link. Instead, you can test manually by typing in the Clean URL for your settings page: http://www.example.com/admin/settings (where www.example.com is replaced by your hostname). If this results in seeing the settings page, and no errors, then Clean URLs are safe to enable, and you can do so with the setting on this page. If there is an error, follow the instructions below to configure your server.
Error recovery


Enabling "Clean URLs" when your server is not properly configured (i.e. if the Clean URLs tests described above fail) can make it difficult to navigate back to administration pages to undo your mistake, because all the Drupal-generated menus and links will have URLs that do not work. If you find yourself in this situation, you can return to the administrative settings page by typing in the URL in the 'non-clean' form: http://www.example.com/?q=admin/settings for the admin settings page in Drupal 4.x, or http://www.example.com/?q=admin/settings/clean-urls to get to the Drupal 5 or Drupal 6 Clean URLs settings page. Once there, you should be able to reset to not using Clean URLs.


There are additional instructions for recovering from malfunctioning Clean URLs the Handbook page Unset clean URLs.
Server configuration for Clean URLs on a dedicated server, with httpd.conf


Enabling clean URLs on a dedicated server involves these steps:
Enable mod_rewrite for Apache. You can talk to your web host or consult the Apache documentation for mod_rewrite to get more information on how to do this. At a minimum, this will involve making sure that mod_rewrite is enabled for your installation of Apache.


To test if mod_rewrite is available in Apache2, you can type the following at a command prompt, to list all installed Apache modules:


apache2ctl -M


On some systems this command may be:


apachectl -M


In the output, check to see if the rewrite_module is included in the list of modules.


If the rewrite module is not in the list, it will have to be either compiled-in or made available as a loadable module. Generally speaking, you can tell Apache to load the module by including


LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
in your Apache configuration file (see below for information on the configuration file). Be sure to uncomment AddModule mod_rewrite.c, if it is in your configuration file but has been commented out. The following may work to enable the module without editing any files:


a2enmod rewrite


Note that these approaches may not work for all combinations of operating system and Apache server -- consult the Apache documentation that came with your Apache software for the correct syntax.


Remember to restart Apache for the new configuration to take effect.
The next step is to locate the appropriate Apache configuration file for your site. Depending on your server configuration, the appropriate Apache configuration file could be httpd.conf, a virtual-host-specific file (vhost.conf), a specific site file (e.g. "default"), or apache2.conf. They are usually located in /etc/httpd/conf, /etc/apache2, or a sub-directory; if not, try the command:



find /etc -name httpd*
to find the file if it is located elsewhere in your file system.


If you do not have write permissions to these files, and Clean URLs are not working out-of-the-box for you, you may have to ask your systems administrator or hosting provider for help. You may still be able to read these configuration files to troubleshoot a little however.
The next step is to copy or include the Drupal-specific settings directly into your configuration file. There are instructions here for how to include the Drupal directives in your configuration file. Consult the .htaccess file in Drupal page for examples of rules, such as the following:



<Directory /var/www/example.com>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>


Make sure that you are looking at the .htaccess file for your major version of Drupal (i.e., 7.x, 6.x, 5.x). If


Note: If you do not want to put the rewrite rules in your Apache configuration file, you can still simply use the Drupal .htaccess file (as you would if you were on shared hosting). You will need to have the Allow Override directive set in your Apache configuration file (this will allow local .htaccess overrides on your site):


AllowOverride All
AccessFileName .htaccess


Read Behind the scenes with Apache's .htaccess for a thorough review of .htaccess. You may also find it helpful to view samples of Apache 2 AllowOverride directives.


Note Regarding MultiViews: Apache supports a feature called "MultiViews" (more generally: "Content Negotiation"), which allows navigation to your pages without the need for file extensions. For instance, if you had a file called "evaluation.txt", a MultiViews-enabled site could access this file with the URL "example.com/evaluation". While MultiViews can be a handy feature when used knowingly, it can cause problems when Drupal's Clean URLs are enabled. Unless you know what you're doing, you should not use MultiViews if you plan to use the Clean URLs feature of Drupal. However, MultiViews is not enabled in a default Apache installation, so it is likely that this note will not apply. Consult the Apache documentation for further information about MultiViews.
Server configuration for Clean URLs on a shared server, with .htaccess

The standard Drupal installation contains a sample .htaccess file which should be sufficient to get Clean URLs running. It is easy to miss copying this file, because of the leading "dot". So before trying to enable Clean URLs, make sure this file exists in your Drupal installation.

To check for this in terminal, use ls -a to make sure the "dot" files are also listed.

If you have this file installed, but Clean URLs still do not work, you can try some of the troubleshooting suggestions below. If you still cannot get Clean URLs to work, contact your hosting provider.
Fixing problems

Check that .htaccess is even being used

Apache needs to be explicitly told to respect the instructions in your sites .htaccess file. This is off by default, though most hosts will have turned it on. That is what the AllowOverride Alldirective above does - it makes .htaccess start working.


To check if your host is currently even reading your .htaccess, you can (temporarily) add some garbage string to the file in an attempt to break it. Your site should immediately start returning a "500 Server Error" when you load a page from that directory due to this misconfiguration. (Remove the garbage string immediately.)


If you do this, and your site does not break - then .htaccess is being ignored and you will not be able to use clean URLs until you get support from your hosts, or enable it in httpd.conf as described above. Some hosts allow you to enable this option through their site management control panel, so look there first.
RewriteBase setting

The main configuration option which may need to be changed for your site is the RewriteBase. This can be specified in the Drupal .htaccess file or in the httpd.conf file, depending on where you are putting the Drupal rewrite directives (see above). By default, the RewriteBase setting is commented out of the Drupal .htaccess file, and that works well for many configurations.


If you are having trouble getting Clean URLs to work, you may need to change this setting. For example, if your Apache DocumentRoot is /var/www/ (i.e., /var/www/index.html is what is displayed when you point your browser at http://www.example.com/) and your Drupal installation is installed in the subdirectory /var/www/mysite/, then the RewriteBase could be set to


RewriteBase /mysite


and that might help. In some configurations, setting


RewriteBase /
will allow clean URLs to work.
$base_url


You may need to manually set the $base_url variable in the settings.php file if not already set. It's currently known that servers running FastCGI can run into problems if the $base_url variable is left commented out (see http://bugs.php.net/bug.php?id=19656).

Multi-site


RewriteBase works when your Drupal installation serves only one site, or when all the sites it serves are in the same subdirectory of their domains. For example,


RewriteBase /
will work for the following sites:


http://www.example.com/

http://www.example2.com/

http://www.example3.com/



RewriteBase /mysite
will work for the following sites:


http://www.example.com/mysite

http://www.example2.com/mysite

http://www.example3.com/mysite


However, if your sites are in different subdirectories, RewriteBase will not work. You will need to create a special rule for each subdirectory. For example, your Drupal installation may serve the following sites:


http://www.example.com/

http://www.example.com/mysite


In order to enable clean URLs for both sites, you will need to add


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/mysite/(.*)$
RewriteRule ^(.*)$ /mysite/index.php?q=$1 [L,QSA]
before the existing rewrite rules.
Location of index.php


For some server configurations, another change to the Drupal .htaccess file may be necessary. Find a line that looks like this, near the end of your Drupal .htaccess file:



RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


You may need to replace index.php with the URL path to your Drupal installation's index.php file (only the part after the base URL). For instance, if your site's home page URL is http://example.com/subdir/, you might need to use /subdir/index.php instead of index.php. If your site's home page URL is http://example.com/, you might need to use /index.php instead ofindex.php. This is necessary on some, but not all server configurations.
Clean URLs on Windows servers with IIS


Starting from Drupal 7, the package includes a basic web.config file for use with IIS.

See this article for more information and setup instructions. 

Create Even Cleaner URLs with the Path Module


Using Clean URLs will cause Drupal to generate URLs in the form "http://www.example.com/node/83." In order to change the 'node/##' portion of the URL to something more like 'news/june-1st-news' a site will need the Path module enabled. See the Path module handbook page for more information on using the path module.