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 great an issue for some of the 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 module configured 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.
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 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:
- Goto the administer >> site configuration >> clean urls 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 -MOn some systems this command may be:
apachectl -MIn the output, check to see if the
rewrite_moduleis 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.
- 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.
- 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>
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 .htaccessRead "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.
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.
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
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 /mysiteand that might help. In some configurations, setting
RewriteBase /will allow clean URLs to work.
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/
And
RewriteBase /mysitewill 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 of index.php. This is necessary on some, but not all server configurations.
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/number' 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.

Need apache VirtualHost setup for rewrites to work
Just thought that It would be good to mention that you need to have a VirtualHost setup in your apache config.
When I did fresh install of apache on ubuntu server 8 I had to first make a static link to the rewrite.load file
as admin I ran the command
a2enmod rewriteHad to setup a virtual host for my domain name
NameVirtualHost *:80
<VirtualHost *:80>
ServerName yourdomainname.com
ServerAlias *.yourdomainname.com
DocumentRoot /var/www/drupal6/
</VirtualHost>
restart apache
/etc/init.d/apache2 restartLitte ontribution
Scenario:
Fedora Core 4
Apache 1.3
Multisite (Many web applications, 4 moodle sites and drupal)
web directory /www/moodle1 - /www/moodle2 - /www/webappx - /www/drupal - etc)
I just added next lines at the server httpd.conf file and it worked
# for drupal, added by achandia<Directory "/www/drupal">
AllowOverride All
</Directory>
restart apache
/etc/init.d/httpd restartI hope this helps.
@ch
Thank you so much
I am a complete newbie and after typing random stuff hear and there for 3 hours.. finally your little comment saved my day..
thanks again..
clean url on multisite
on a drupal regular multisite clean url will not work without .htaccess in each project root, so make sure to copy also .htaccess
/.htaccess
/anothersite/.htaccess
Hope that helps anybody
Clean URL .htacccess with DreamHost, GODaddy and Bluehost
DreamHost users have to use following code in .htaccess for clean URL
I haven’t test on godaddy and blueshot, but they should work the same
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
Working with Fatcow
This is working with fatcow too.
godaddy settings
As a further update on anyone using godaddy:
I have a deluxe hosting with many sites. Using ftp, I edit the .htaccess file for the directory I am loading drupal in. At the bottom, remove the comment symbol to show the following
<IfModule mod_rewrite.c>RewriteEngine on
#
# big bunch of comment lines
#
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
The line with favican.ico was there. Even though I am using a subdirectory, I didn't need to change any of the lines. Save and check clean url's. Should work right away.
Thank you SO much!
@sunward - you salvaged me from hours of frustration! I had tried everything that I could find/think of. My Drupal site in a sub directory now has nice, clean URLs and I can now put it live! :)
As with you, I have a GD Deluxe/Unlimited account with many sites, mostly Joomla! but a few Drupal now :) The primary domain for the account is a Joomla! site so that htaccess file has to be in the root of the account for the SEF URLs (Joomla-ese for Clean URLs) to work and all the other Joomla! sites in their own sub directories run off the htaccess in the root. So I had tried "too hard" with making the Drupal one work; all it was was uncommenting the RewriteBase / !!! I had tried every other combination but the most obvious :)
Thanks again!
Cheers!
Lyle
http://www.2ninerniner2.com - free templates and themes for Joomla!, Drupal, WordPress and HTML
... Joomla! tips and getting started guides for beginners
http://www.goodmealscheap.com - affordable comfort food that's easy to make
@2ninerniner2
thank you but alas, it
thank you but alas, it doesn't work for me.
my site is http://redd-plus.com/drupal
it's a shared hosting account so .htaccess is in path/to/html/redd-plus/drupal
to be able to use Clean Urls i had to change RewriteBase to /drupal
the rewrite stuff in .htaccess is just like yours.
however, once CleanUrls are enabled something strange happens: none of the posts have clean urls, however menu items (Administer, Search, Create Content, etc) do have clean urls.
any ideas out there?
I used this with Bluehost and
I used this with Bluehost and it works great.
Thanks!
--
Dave
Mac OS X 10.5 (client not Server)
To turn on clean URL's on Mac OS X 10.5.6:
Add
AccessFileName .htaccessto /private/etc/apache2/httpd.conf
Then dependant on where you have installed drupal either:
If you've installed it in /Library/WebServer/Documents
In /private/etc/apache2/httpd.conf change the AllowOverride directive to
AllowOverride Allwithin the
<Directory "/Library/WebServer/Documents">block.If you've installed it in /Users/<username>/Sites:
In private/etc/apache2/users/.conf change the AllowOverride directive to
AllowOverride Allwithin the
<Directory "/Users/<username>/Sites">block (it's likely this will be the only block in this file).Finally in the .htaccess file in the drupal directory uncomment the line
#RewriteBase /drupaland change the /drupal to what ever is appropriate for your install
Good luck!
for the last step. this
for the last step. this worked for me
RewriteBase /~[username]/ouroakland/htdocs
but this did not:
RewriteBase /Users/[username]/Sites/ouroakland
the leading slash is required.
Glad it worked for you, but ...
... but what finally worked for me was:
httpd.conf (mine is at /opt/local/apache2/conf since I'm using a MacPorts installation)
DocumentRoot "/Users/elisevanlooij/Sites"
<Directory "/Users/elisevanlooij/Sites">
~/Sites/Drupal6/.htaccess (I also have a Drupal5 install in Sites)
RewriteBase /~elisevanlooij/Drupal6Thank you Dilby for taking the time to write out these instructions for your fellow 10.5 users. I'm really happy to finally have this working.
Thank you
Thank you so much your and dilby's comments finally made things clear for me, fixed my problem, and allowed me to turn on Clean URLs.
1And1 Solution
For 1And1 with PHP 5, only change needed is:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
to:
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
Found solution here: http://geeksandgod.com/forum/drupals-clean-urls
Using Clean URLs and WAMP2
Windows
c:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf
uncomment
#LoadModule rewrite_module modules/mod_rewrite.so
will have
LoadModule rewrite_module modules/mod_rewrite.so
Uniform Server 4.0 (Mona)
This edit is also required in uniserv 4.0.
Edit the file
[drive][path]\Uniform Server\udrive\usr\local\apache2\conf\httpd.conf
Change line 194
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
See http://wiki.uniformserver.com/index.php/Installing_Drupal_on_4.0-Mona for more tips.
Versions prior to 4 already have the rewrite_module line uncommented.
UBUNTU
I wanted to share my problem with getting clean urls to work in ubuntu. I couldn't find any info on how to do this, but finally I pieced it together and it is actually very simple. Just do the following:
1)enable rewrite module on apache.
a2enmod rewrite
(to disable type a2dismod rewrite)
2)Set directory permission.
You must find the file that sets permission of each directory for apache. In my case it was /etc/apache2/sites-enabled/000-default
edit the page so that the directory that you will be using to serve webpages has "AllowOverride All". My file contains the following:
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
3)Just restart apache and it should be working:
/etc/init.d/apache2 restart
Great Job!!!
In testing Ubuntu 9.10 I've set up 2 different servers 1) Ubuntu w/XAMMP and 2) Ubuntu with LAMP install from the server installation...both were different in getting this to work. Thanks.....
My Situation
I installed Drupal (6.9) in a subdomain using GoDaddy hosting. I was initially unable to use clean URLs.
First I changed the RewriteBase directive to "/subdomainfolder". That didn't work.
Next, I added the "AllowOverride All" and "AccessFileName .htaccess" directives to the .htaccess file but that only produced a 500 error.
Lastly, I commented out the "AllowOverride All" and "AccessFileName .htaccess" directives and added a "/" in front of "index.php" in the line reading "RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]" to make it "RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]"
That worked.
subpath in Debian
In Debian, when you want to use clean URLs with a subpath you can do it in the following way:
<Location /mysubpath><IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/usr/share/drupal6/(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
</Location>
This will give you a Drupal site at http://example.com/mysubpath/
Make sure to update the RewriteRule line with whatever version of Drupal you happen to be using.
Apache no longer needs AddModule
AddModule used to be used to control the order in which you enabled the different Apache modules. However as of Apache 2.0 the directive AddModule is no longer required (pop to the apache site for a full explanation) so there's no need for
AddModule mod_rewrite.c
unless you're running an older Apache.
Network Solutions Fix
Network Solutions hosting is a complete disaster, but if you're stuck with it the following post helped me get Clean URLs working in a D6.10 install.
http://drupal.org/node/11861#comment-18597
This only applies to the shared unix hosting package, where PHP is run through CGI.
In short, you need to create a php.ini file in the /cgi-bin folder at the root of your Network Solutions directory.
Fill the php.ini with the settings from the IfModule mod_php5.c section of your Drupal install's .htaccess. You can't just cut and paste because the ini format is parsed differently than .htaccess.
In D6.10, your php.ini file should looks like this:
register_globals = offmagic_quotes_gpc = 0
register_globals = 0
session.auto_start = 0
mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = 0
Then you need to set BOTH the RewriteBase in your .htaccess file, and the $base_url variable in your site's settings.php file.
Go back to the clean urls admin page, and you should be able to flip the switch.
Some have reported that you need to comment out the Options +FollowSymLinks setting in your .htaccess file, but I haven't had to do so.
It's also worth noting that you won't be able to make it through the install process without errors without setting up a php.ini file as described above to disable register_globals.
Clean URLs on DotEasy Hosting
I just installed Drupal 6.10 in a subdomain hosted by doteasy.
I read for hours about Apache Modules and mod_rewrite in particular only to discover that getting clean URLs to work is very easy in this situation.
Maybe this will save you some time:
1. Make sure you include the .htaccess file with the rest of your Drupal files in the directory on the server. Obvious to some, but .htaccess files are hidden by default in OSX and not included in a standard drag-and-drop transfer from your local directory to an FTP client. Installing Drupal is 100% possible without the .htaccess file but enabling clean URLs in a shared hosting environment is not.
2. Uncomment line 101 of the .htaccess file -- the one that has the "RewriteBase /" command
------------------
website | livejournal
I use Aplus.net hosting and this worked for me!
Uncomment line 101 of the .htaccess file -- the one that has the "RewriteBase /" command
Thanks so much!
17
Tip on .htaccess
I moved an existing site to another server, but the clean URLs no longer worked. After spending umpteen hours trying to troubleshoot it, I found the problem. Apache has multiple references to the .htaccess file. The first is a "default" setting as follows (even though I had changed the AllowOverride to All, it had no effect because it was overridden later [see below]):
<Directory />Options FollowSymLinks
AllowOverride None
</Directory>
The second reference actually overrides the default setting:
<Directory "/var/www/html">AllowOverride None
</Directory>
After changing that setting, my clean URLs were all bright and shiny again! :-) Probably a no-brainer for those who spend a lot of time in the httpd.conf file, but it escaped me because I kept referring to the default setting.
Getting clean URLs working under Windows running Apache2
I got this from http://quillem.com/node/506 and it worked:
In your httpd.conf uncomment
#LoadModule rewrite_module modules/mod_rewrite.so
and add the following in httpd.conf with Directory config block, replace the path with the path of your Drupal installation:
Options FollowSymLinks
AllowOverride All
RewriteEngine On
Note: there is no "AddModule mod_rewrite.c" needed
This also works for 1and1 customers!!!
Great Job!! This also works for 1and1 customers!!!
Clean URL .htacccess with DreamHost, GODaddy and Bluehost
dannychang - December 26, 2008 - 21:34
DreamHost users have to use following code in .htaccess for clean URL
I haven’t test on godaddy and blueshot, but they should work the same
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
-------
mod_rewrite on Mac Os X in vhost.conf...
mod_rewrite & Virtualhosts on Mac OS X Leopard Server
After much trial and error (mostly error). I finally got Clean URLs working on my Mac server. However let me start off by station that my Leopard server does not run the stock Apache, but one that I built form the ports tree because the stock one is a rpita!!! when it comes to php customization. Plus Apple is rather slow to keep up with basic security updates on UNIX ports.
RewriteEngine off<Directory "/Volumes/Data/web/SOMESITE.com/public/">
AllowOverride Options
<IfModule mod_dav.c>
DAV Off
</IfModule>
Options All -Includes -ExecCGI +MultiViews -Indexes
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</Directory>
Thanks to this note I found on the Zend Framework Page regarding mod_rewrite which suggests placing a forward slash before index.php. I did try the tag but that did not work so I moved things around and well struck pay dirt. I shall test this on one of my FreeBSD web servers tomorrow morning and if it work I'll make another note.
I hope this saves someone hours of headaches from not having to knock their head on a wall...;-|
<VirtualHost *>ServerName beta.SOMESITE.com
ServerAdmin admin@example.com
DocumentRoot "/web/SOMESITE.com/public/"
DirectoryIndex "index.php" "index.html"
CustomLog "/web/SOMESITE.com/logs/access_log" "%h %l %u %t \"%r\" %>s %b"
ErrorLog "/var/log/apache2/error_log"
ErrorDocument 404 /error.html
<IfModule mod_dav.c>
DAVLockDB "/var/run/davlocks/.davlock100"
DAVMinTimeout 600
</IfModule>
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
</IfModule>
RewriteEngine off
<Directory "/web/SOMESITE.com/public/">
AllowOverride Options
<IfModule mod_dav.c>
DAV Off
</IfModule>
Options All -Includes -ExecCGI +MultiViews -Indexes
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</Directory>
LogLevel warn
ServerAlias beta.SOMESITE.com
</VirtualHost>
Cheers,
Mikel King http://twitter.com/mikelking
http://olivent.com
http://jafdip.com
http://mikelking.com
mod_rewrite & Virtualhosts on FreeBSD 7.2 w/ Apache2.2
mod_rewrite & Virtualhosts on FreeBSD 7.2 w/ Apache2.2
I have just confirmed that this also works on FreeBSD 7.2 if there is anyone out there with some Linux boxes that could give it a go I'd be keen to know if it works on them as well.
At some point I shall give it a go on the stock Apache that comes with Mac Os X Server...
RewriteEngine off<Directory "/web/SOMESITE.com/public/">
AllowOverride Options
<IfModule mod_dav.c>
DAV Off
</IfModule>
Options All -Includes -ExecCGI +MultiViews -Indexes
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</Directory>
Cheers,
Mikel King http://twitter.com/mikelking
http://olivent.com
http://jafdip.com
http://mikelking.com
Bing-O!
We have a winner. Thanks for the valueable solution.
"Amatuers practice until they get it right, experts practice until they can't get it wrong."
- Faith Duck
ISAPI Re-write
Thought I'd report back.
It's been several hours now and 5 re-boots of my server just in case it was services not starting of something. I must have visited 20 websites and checked everything I could.
Finally I decided to download the trial version instead of the free 'Lite' version. Bam! Working straight away - I guess they don't want anyone to go without paying. I'm sure they deserve their money. I just wish someone would pay me for the hours of banging my head against a wall.
I'm very glad it's working. I just feel a bit flat after so much effort and so many angry thoughts running through my head.
Adding rewrites to Mac Leopard Server
1. make sure
mod_rewrite.sois checked on in Server Admin2. if Server Admin on your system allows you to check "Allow All Overrides" in the Apache Options for your site, you're done. Otherwise...
3. edit
/etc/apache2/sites/[0000_your_site_info.conf](where is a filename corresponding to the site you have created in Server Admin -> Web -> Sites) and make the following change:<Directory "/Library/WebServer/Documents">entry (if you haven't changed your site's root, otherwise look for the entry with your specified root)AllowOverride NonetoAllowOverride AllFix for Omnis Hosting
To get clean urls working with my Omnis hosting account, I had to remove the following from the standard .htaccess file:
# Follow symbolic links in this directory.
Options +FollowSymLinks
6.14 headaches...help? Clean URLs
I'm not sure what I've done wrong, but something's way off.
I followed the directions on the install of 6.14 after removing 6.13. Initially, everything looked fine, but then I noticed that all the admin links pointed to the old (formerly functional) clean URLs. The problem is that drupal wasn't producing clean urls so no clean urls were functioning.
After multiple updates and cron runs, htaccess reviews and everything else that I know how to do, I'm still stuck with "dirty" URLs and this message: "Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information."
Please, someone give me something helpful. I host with:
-Marblehost,
-Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7e mod_auth_pgsql/2.0.3
-PHP 5.2.10
Anyone got any suggestions?
Clean URL on drupal 6.14
Hi
I have a similar problem but when I transfer the site to the final server, it shows me a similar message so what I did was
- check if the rewrite module is enabled
prompt$apache2ctl -Mand as it was enable I add this code to my httpd.conf to allow clean URLs
# Various rewrite rules.<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /home
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
this works for me. the /home is for my drupal installation location
drupal 6.14
Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch
Images won't display
I enabled CLEAN URL and all my images stopped displaying. I have the following contributed modules installed:
Images
Global Redirect
Pathauto
Meta Tag
Page Title
Token
Views.
What could be the problem?
I've had this before. It
I've had this before. It turned out to be a problem with the base url. Have a look at your settings.php and your .htaccess, make sure your base urls are correct. This worked most of the time for me because it now knew to look in /mysite/files/image.jpg (if drupal was installed in a subdirectory), but also failed for me on a theme that I wrote for myself because I had written it badly. I solved that problem by using drupal's base_path() like this:
$img = '<img src="'. base_path() .'files/myfile.jpg" />';Bruce
Ubuntu Clean URLs setup
Hi. I get irritated every time I have to do this, so writing a note for me and for everyone else that it might help:
Setup LAMP on Ubuntu. Create symbolic link to phpmyadmin (just by the way because its annoying to remember):
Setup instructions here: http://www.ubuntugeek.com/howto-install-lamp-server-in-jaunty.html
Creating link:
sudo ln -s /usr/share/phpMyAdmin /var/wwwInstall mod_rewrite:
sudo a2enmod rewriteAdd this to conf (sudo gedit /etc/apache2/httpd.conf):
<Directory /var/www/fridays>RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
AllowOverride All
</Directory>
Restart Apache:
sudo /etc/init.d/apache2 restartHope that works straight away for someone. Took me 2 hours to work out.
Bruce
to enable Clean URL
Hi everyone I just enabled clean URL. It looks like it 's working. You have to edit . htaccess. If you have drupal on a hosting provider. Edit it in cpanel > file manager > find .htaccess file > right mouse button > edit (or maybe there is another way to edit that is really depends on the cpanel you're using). find the following lines:
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /
Follow the instructions which means delete the '#' before RewriteBase/
After tahta go Administer > Site configuration > Clean URL > enable and after that you test it out.
Enable clean URL drupal 6.x
Hi there
I got it to work and just follow the instruction. I am able to enable it but when i clicked on administer page, it says page is not found ? why is this ???
Thanks
http://www.holeepassion.com
Positive actions for saving EARTH
Clean URLs with Apache in Windows
The folder name where you host your site (DocumentRoot) cannot contain blank spaces for the clean urls to work.
Example:
DocumentRoot "C:/Documents and Settings/Ignacio/My documents/Webs/My site" --> WRONG
DocumentRoot "C:/Documents and Settings/Ignacio/My documents/Webs/MySite" --> CORRECT
Note that you may use blanks inside the path ("Documents and setting", "My documents"), but not in the last folder of the path ("My site")!!!
how do you enable/disable Clean URLs in drupal 7?
how do you enable/disable Clean URLs in drupal 7?
Corrected rewrite rule for multi-site
Under "Multi-site" above, we find the following prescription:
In order to enable clean URLs for both sites, you will need to add
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/mysite/(.*)$
RewriteRule ^(.*)$ /mysite/index.php?q=$1 [L,QSA]
before the existing rewrite rules.
The
$1in the last line should be%1, since we want to take the back-reference from the last RewriteCond, not from the RewriteRule itself.If we use
$1, we get an extra "mysite/" in the query part of the URL. As an example, for /mysite/target-url we get:/mysite/index.php?q=mysite/target-url
With
%1, we instead get/mysite/index.php?q=target-url
which is what we want.
Rewriting root to existing subdirectory
Having installed Drupal v6 in a subdirectory /drupal, I wanted to "move" the installation to the root, without having to move all the files up a level. After finding some great posts online, this could be done with a .htaccess file and a few other tweaks, mainly sourced from a post "Getting started with Drupal 6 in a subfolder". In a nutshell:
1. I created a new
.htaccessfile in the root, containing:RewriteEngine onRewriteRule ^$ /drupal/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ drupal/$1 [L,QSA]
2. I deleted the existing file in the root,
index.htm, so that it would not be found and served up. You might also need to remove, if it exists,index.php(actually I renamed the files on the server, so that if I encountered a problem, I could rename it back, and continue with the old site)3. In
sites/default/settings.php, I changed the commented line to:$base_url = 'http://www.mydomain.com'; // NO trailing slash!D6: Auto test failed
I struggled an hour before understanding that the test which allows to enable clean-urls which was failing.
I was modifying my configuration and was refreshing http://localhost/q=admin/settings/clean-urls , unable to enable it.
After validating that mod_rewrite was enabled, I guessed this auto-test was failing, and tried to reload my page at http://localhost/admin/settings/clean-urls . The test succeeded and I was able to enable clean urls :p
Here's another fix
I just spent hours trying to figure this out - and finally got it to work trying something I haven't seen listed elsewhere:
I had been opening the httpd.conf file in dreamweaver - editing per instructions found here - then closing it. Turns out, Dreamweaver was adding something to the mix unbeknownst to me. Opening the httpd.conf file in notepad, editing and saving out that way suddenly made everything work. Here are the only changes I made:
1) Per an earlier message in this thread, I removed the hash (#) mark before the following in the .htaccess file:
RewriteBase /
2) I removed the pound sign/hash mark/# before the following in the httpd.conf file:
LoadModule rewrite_module modules/mod_rewrite.so
After saving each of those files, (again, editing in notepad as opposed to dreamweaver) I simply restarted "all services" and refreshed the "clean urls" page on my site and was able to enable clean urls.
Note: I made no other changes; other suggestions/coding found in this thread were unnecessary for my setup (wamp, windows xp home, apache 2.2.11, php 5.3.0, drupal 6.15)
mod rewrite on Ubuntu
In Ubuntu you can instead of using a2enmod rewrite also copy
the module rewrite.load from /etc/apache2/mods-available to
/etc/apache2/mods-enabled. Make sure the /httpdocs contains
the relevant .htaccess that comes with Drupal, else it won't work
even if mod rewrite is activated.