Once drupal is installed, you should configure is before you do anything else. The few articles would guide you through drupal configuration.
When you set site maintenance to offline, you lose the link to you login form as well. To get the login form, you need to do the following:
http://www.mysite.com/q=user or http://www.mysite.com/user
Do not replace the word user with your username.
If this doesn't work, log into your database and type the following SQL commands.
UPDATE variable SET value = 's:1:"0";' WHERE name= 'site_offline'; DELETE FROM cache WHERE cid = 'variables';
If you lost your mysql password, go to your drupal installation directory. Then navigate to sites/default. You should see a file by the name of settings.php. Open this file and look for a line which looks like the following.
mysql://username:password@localhost/databasename
Then type the following:
mysql -u username -p databasename
You will be prompted for you password. Once logged in type the SQL commands listed above.
Drupal URLs have the format http://www.molecularsciences.org/?q=node/11. '?q=' does not look very nice in the URL. It also hinders using meaningful URLs. Search engines such as google and yahoo prefer clean URLs. To enable clean URLs:
Administer > Site Configuration > Clean URLs > Run the clean URL test
You should get a message like follows:
"This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL.) You have successfully demonstrated that clean URLs work on your server. You may enable/disable them as you wish."
If you get this message:
Enabled > Save Configuration
If you do not get the desired results from the Run the clean URL test, you need to modify your .htaccess file located in your drupal root folder. My drupal root is located at c:\www\drupal :
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
What do these odd three lines of code actually do.
1. If requested file exists, serve it.
2. If requested directory exists, serve it depending on how index option is configured.
3. Otherwise, send all requests to index.php, setting parameter ‘q’ as the path of the original request, and then append the rest of the query string.
Following is what my .htaccess file looks like. If nothing else works, try copy pasting this:
#
# Apache/PHP/Drupal settings:
## Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch># Don't show directory listings for URLs which map to a directory.
Options -Indexes# Follow symbolic links in this directory.
Options +FollowSymLinks# Customized error messages.
ErrorDocument 404 /index.php# Set the default handler.
DirectoryIndex index.php# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule># PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule># PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule># Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule># Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
Options All# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /drupal# Rewrite old-style URLs of the form 'node.php?id=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^id=([^&]+)$
RewriteRule node.php index.php?q=node/view/%1 [L]# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# $Id: .htaccess,v 1.81.2.3 2007/09/21 12:24:22 drumm Exp $
Restart Apache so that the changes can take effect.
There are various different errors that can be generated by a website. Apache errors (mostly 403 and 404), SQL errors, and PHP errors. A 403 error is generated when access to a page is denied. A 404 error is generated when a page is not found on the server. All errors are logged in an error log. In drupal, we can define custom pages for 403 and 404 pages.
First we would create a page for 404 errors. To create a page:
- Create content > Page
- For title, type "Page not Found".
- For body, type a custom error message such as "The page you request cannot be found, please re-check the URL"
- Click on the "Publishing options" link at the bottom and make sure that the "Published" checkbox is checked.
- Click on submit
Now look at the url. You would see something like node/1. Jot down this number somewhere.
Now go to:
Administer > Site Configuration > Error Reporting
In the first field, type user. This would redirect the visitor to the log in page whenever, he comes across a page he does not have the rights to access.
In the second field type node/1 or whatever you jotted down from the previous step.
The rest should be pretty self-explanatory.
Input formats define a way of processing user's text. The input is stored as text. Filters are applied before the text is displayed on a web page. Every input format is a set of filters which are applied to the text. For example, a filter can replace return with <br> tags or convert a URL into a link. Users can choose an input format before submitting content.
You can also define you own custom input formats. To define a new custom format:
Administer > Site configuration > Input formats > Add input format
- Type a name for your filter
- Choose Roles
- Choose Filters
- Save configuration
Basic information about the site can be defined in the site information page.
Administer > Site configuration > Site information
Here you can define the site name, slogan, mission and footer.
Anonymous user is a user who posted something without logging in. It is usually not good idea to allow anonymous users to post on your site. You would soon find yourself under attack from spambots. If you do allow anonymous posts, the name you specify here would appear as the author. I usually change this field to a blank screen.
You can also define the address of the front page. By default, it is node which lists the latest published articles. Very often, we would like it to be something different. To change it, simple type in the address of the desired page. Do not, however, type in the url alias.
Site information is often theme specific, so you need to configure your theme as well:
Administer > Site building > Themes > Configure
Themes are website designs. Drupal offers you a wide variety of themes to choose from. Changing a theme (look and feel of the entire website) is as easy as changing gears in a car. You can either use global configuration which affects all themes or make theme-specific configuration. Here we would mind ourselves with global configuration.
Here you define what would be visible and what would not be. In the Toggle display section, you define whether you want to make the logo, site name, slogan, mission, or shortcut icon to appear. Shortcut icon is the small icon which appears before the url. In the Logo image settings sections, you can upload your logo. The default logo is the logo provided by the theme. A similar section, Shortcut icon settings also exists for shortcut icon.
The user information is the name of the author, date and time of publication of a post. If you check the checkbox, this information would appear. I usually do not like to show this information and therefore uncheck these boxes in the Display post information on section.
The current theme's configuration overrides the global theme configuration. If you wish to use the global theme's configuration, click on your current theme (garland in my case) and click on Reset to defaults to use the global configuration.
A theme is a collection of files which together determine the look and feel of a drupal web site. Themes are available for free or a small price on the Internet.
Themes can be found at http://drupal.org/project/Themes. Suppose we want to download the art4 blue theme. Drupal themes and modules are available as zipped tar files. On Unix, you do the following:
$ wget http://the-site/theme.tar.gz
$ tar -xzvf theme.tar.gz
$ rm theme.tar.gz
On windows, download http://www.7-zip.org/. This free tool works with several unix specific zipped files. I have installed cygwin, which allows me to run unix command-line tools on my windows machine.
Once you have extracted the files, you need to upload the folder into the themes folder. I use fireftp to upload files. It is very neat firefox plugin.
Once you have uploaded your files, they should become visible in the list of themes:
Administer > Site building > Themes
Click on the radio button and checkbox to the right of your new theme and click on save configuration.
To delete a theme, just delete its folder from the theme.
Different websites have different needs. The needs of Amazon, Google, and the neighborhood pizza restaurant differ greatly. This is why most no single software can respond to the needs of every client. Drupal was built with this in mind. Drupal comes with a core which can be extended with modules. The core provides essential functions and enables integration and controlled interaction between different modules. Modules can be created by anyone. Modules integrate seamlessly with drupal as long as they are created following drupal guidelines and conventions. Hundreds of really cool drupal modules are available for free on the Internet. Your goal as a beginning drupal user should be to find and install the modules that would allow you to provide the functionality you want to provide to yourself and your users.
Before a module can be used, it must be enabled.
Administer > Site building > modules
Click on the checkbox next to Contact and then click on Save configuration. Once a module is enabled, its settings and other options become visible. In this case, the Contact form link become visible under Site building. Lets create a contact form.
Administer > Site building > Contact Form > Add Category
Fill in the form and hit submit. Repeat this several times, once for each email account that would be receiving emails. Type the following URL in you address bar:
Here you would see a contact form where the category allows you to choose between email accounts. Note that the email addresses are not show and thus cannot be copied by spambots.
Drupal comes with several preinstalled modules such as Contact form we just used. As there are hundreds of modules, most of the modules you would use would have to be downloaded and installed. Modules can be found at http://drupal.org/project/Modules. Suppose we want to download the diff module. Drupal themes and modules are available as zipped tar files. On Unix, you do the following:
$ wget http://the-site/module.tar.gz
$ tar -xzvf module.tar.gz
$ rm module.tar.gz
On windows, download http://www.7-zip.org/. This free tool works with several unix specific zipped files. I have installed cygwin, which allows me to run unix command-line tools on my windows machine.
Once you have extracted the files, you need to upload the folder into the modules folder. I use fireftp to upload files. It is very neat firefox plugin.
Once you have uploaded your files, they should become visible in the list of modules:
Administer > Site building > Modules
Click on the radio button and checkbox to the left of your new module and click on save configuration to enable it.
Before installing a module, you should read its README.txt and INSTALL.txt file. Certain modules conflict with others, and some require special configurations. These small and easy to read files would save you lots of trouble.
To delete a module, just delete its folder from the modules directory.
Both PHP and drupal impose limits on the file size of attachments. To edit the default settings:
Administer > Site Configuration > File Uploads
Your PHP settings limit the maximum file size per upload to 2 MB.
upload_max_filesize = 2M
For sound security reasons every file type is not allowed in an attachment. The allowed attachments are listed in Default permitted file extensions field on the following page.
Administer > Site Configuration > File Uploads