Last updated November 19, 2010. Created by Heine on January 6, 2006.
Edited by ghoti, lbourn, add1sun, webchick. Log in to edit this page.
Clean URLs do not work out of the box on XAMPP 1.5.x with PHP4 due to a problem in Apache's module load order; mod_rewrite will not work properly. To remedy this you will need to edit the file [path_to_xampp]/apache/conf/httpd.conf.
mod_rewrite location
Remove the # at the beginning of this line:
LoadModule rewrite_module modules/mod_rewrite.soand move it to just above or below
#LoadModule cache_module modules/mod_cache.soAllowOverride
If the mod_rewrite change does not work, you also need to check that AllowOverride All is set for the directory Drupal is in. Do this in httpd.conf or extra/httpd-xampp.conf
Open up file \apache\conf\extra\httpd-xampp.conf
Put this code in:
Alias /drupal "C:/Program Files/xampp/htdocs/drupal/"
<Directory "C:/Program Files/xampp/htdocs/drupal">
AllowOverride All
Order allow,deny
Allow from all
</Directory>Remember to change the path to match your installation location.
If you're not sure where to add it, it might be worth putting it under the entry
Alias /security "C:/Program Files/xampp/security/htdocs/"
<Directory "C:/Program Files/xampp/security/htdocs">
...
...
</Directory>which should already exist.
Always restart Apache after you make changes or the changes to its configuration files won't have an effect.
Drupal Directory
If Drupal is not installed in the document root, the next thing you'll have to do is modify the file .htaccess that comes with Drupal. Remove the commentsign (#) in front of RewriteBase and, if necessary, modify the path:
RewriteBase /drupalFinally, in Drupal go to Administer » Site Configuration » Clean URLs (admin/settings/clean-urls) and run the clean URL test. Then click the "Enabled" option for Clean URLs and save the settings.
Comments
thanks, this was very
thanks, this was very helpful. I've been banging my head for a while and these instructions came quite in handy
thanks. it seems to be very
thanks. it came in very handy, although I got myself into trouble with it. so, for hypercorrect newbies:
in the line
Alias /drupal "C:/Program Files/xampp/htdocs/drupal/"
only the last "drupal" must perhaps be adapted to whatever you've called the folder of your drupal installation. say, you wanted an address like http://localhost/site1 and you've changed the folder name from drupal-6.2 to site1, then this line must become
Alias /drupal "C:/Program Files/xampp/htdocs/site1/"
I hope that wasn't more confusing than helpful, but it took me quite a while to find out that this was the cause of a persisting No access - error 403 message on my locally built site and I thought maybe someone would encounter the same.
Joris
Thanks. Saved me a lot of time
Clean URLs worked fine on my local XAMPP installation for the default drupal site, but would not work when I tried to enable other sites with multisite. Just uncommenting the Loadmodule rewrite line and moving it up as indicated did the trick for it to work on all the multisites. Now I can replicate my server installation on my pc for proper testing... :p
------
Con paciencia y calma,
sube un burro a una palma
------
Con paciencia y calma,
sube un burro a una palma
Relief 2.0 - http://www.relief20.com
Navidad Latina - http://www.navidadlatina.com
very helpful!
thank you for the very helpful information.
Thanks, but still struggling
Thanks, but still struggling for some reason. I tried to follow your instructions to the letter and made all the changes above, but unfortunately I still can't enable clean URLs. The only room for interpretation in your instructions seems to be in the placement of the AllowOverride code, and perhaps the RewriteBase change code. So I suspect I've made a mistake in one of those two places.
First, I'm pasting my entire file here so that there's no ambiguity on where I placed the code snippet for AllowOverride. Is it in the right place?
# XAMPP settings
#
<IfModule alias_module>
<IfModule mime_module>
#ScriptAlias /php/ "C:/xampp/php/"
#Action application/x-httpd-php "/php/php-cgi.exe"
LoadModule php5_module "C:/xampp/apache/bin/php5apache2.dll"
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt
<Directory "C:/xampp/htdocs/xampp">
<IfModule php5_module>
<Files "status.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
</Directory>
Alias /security "C:/xampp/security/htdocs/"
<Directory "C:/xampp/security/htdocs">
<IfModule php5_module>
<Files "xamppsecurity.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Alias /drupal "C:/xampp/htdocs/drupal/"
<Directory "C:/xampp/htdocs/drupal">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp/webalizer">
<IfModule php5_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Alias /contrib "C:/xampp/contrib/"
<Directory "C:/xampp/contrib">
<IfModule php5_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</IfModule>
</IfModule>
# Access restriction via Remote
<IfModule auth_remote_module>
<Directory "C:/xampp/htdocs/fonts">
AllowOverride All
AuthType Basic
AuthName "AUTH REMOTE TEST"
AuthRemoteServer localhost
AuthRemotePort 80
AuthRemoteURL /forbidden/
Require valid-user
#User: user / Password: pass
</Directory>
</IfModule>
# Access restriction via MySQL
<IfModule mysql_auth_module>
<Location /restricted>
AuthMySQLEnable On
AuthName "MySQL Secured Place"
AuthType Basic
require valid-user
AuthMySQLHost localhost
AuthMySQLUser root
# AuthMySQLPassword
AuthMySQLDB webauth
AuthMySQLUserTable user_pwd
AuthMySQLNameField name
AuthMySQLPasswordField pass
AuthMySQLPwEncryption none
</Location>
</IfModule>
Do you see a clear mistake? I edited the file at apache\config\extra rather than the one at apache\config. Would that make any difference?
Secondly, could you let me know exactly what changes I need to make for the RewriteBase change in the following section of the .htaccess file, given that the live site lives at http://localhost/drupal and the directory lives at C:\xampp\htdocs\drupal ?
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /xampp/htdocs/drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
I tried uncommenting in both lines with RewriteBase above, and changing the path in the second case the /drupal but no dice yet.
Thanks for any help.
*_*
Subscribing.
:)
Beautifulmind
:)
Beautifulmind
mee too
mee too... ;)
Yuvraj
Thanks!
I was struggling with XAMPP/OSX and clean urls. Thank you!
Director of Technology
Groove 11
San Rafael, CA
XAMPP 1.7.x
The latest version of XAMPP (1.7.1) does have Clean URL support out of the box.
Simply fantastic
It worked perfectly for me... thanks alot
-Asim Bashir Bhatti
.htaccess
To anyone who has no success with any of the listed steps... If you were importing a remote site to your xampp installation, check to make sure you included the .htaccess file in the root directory. Without it, clean URLs won't work... I've just been scratching my head over this for 40 minutes and finally noticed I was missing the .htaccess file...including it solved the problem!
Subtle Change to .htaccess
For people using XAMPP whose site is localhost subfolder, I had to
make one tiny change in my .htaccess file before I could enable
Clean URLs.
My RewriteRule line was set to this by default:
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]I had to change it to:
RewriteRule ^(.*)$ /subfolder/index.php?q=$1 [L,QSA]This may be mentioned in other comments and posts, but I didn't see it
and I spent several hours trying to figure it out.
Also, make sure your .htaccess file is being read or you're wasting
your time editing it!
Director of Technology
Groove 11
San Rafael, CA
For pure install Apache2 on Windows7
All this in: Apache2/conf/httpd.conf
Enable:
LoadModule rewrite_module modules/mod_rewrite.soand then put this code:
Alias /drupal "C:/yourpath/drupal/"<Directory "C:/yourpath/drupal">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
And happynes !
Works like a charm!
Works like a charm!
Worked Perfect!
This is the only comment regarding this issue I found anywhere that worked. Simple, but very easily overlooked! Thank you!!
After a lot of scratching my head...
This works great, its important to remember that for Apache XAMPP my directory names were for:
.htaccess (in the drupal installation folder) - RewriteBase /xampp/drupal
httpd-xampp.conf (in the apache folder) - Alias /drupal "/xampp/xampp/htdocs/xampp/drupal/"
Directory "/xampp/xampp/htdocs/xampp/drupal"
Other than the instructions above, nothing else needs to be edited in the .htaccess file for drupal if being used on a localhost xampp server.
r~n