Server configuration for Clean URLs on a dedicated server, with httpd.conf
Enabling clean URLs on a dedicated server involves these steps:
1. 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.
Note that this 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.
2. #
# 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 providor for help. You may still be able to read these configuration files to troubleshoot a little however.
3. 3. 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:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
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; this other site has samples of Apache 2 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.
- drupal6's blog
- Login or register to post comments
1 year 1 week ago
1 year 1 week ago
1 year 1 week ago
1 year 1 week ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 4 weeks ago
1 year 4 weeks ago