By jeff00seattle on
- Enter Apache 2.2 conf directory:
> cd C:\Program Files\Apache Software Foundation\Apache2.2\conf - Open httpd.conf
> notepad httpd.conf - Uncomment loading of read-write module by removing #:
LoadModule rewrite_module modules/mod_rewrite.so - Uncomment including virtual hosts delaration file by removing #:
# Virtual hosts Include conf/extra/httpd-vhosts.conf - For declaring only localhost
- create or clear contents of file conf/extra/httpd-vhosts.conf
- Copy and paste the following in this file:
<Directory /> Options FollowSymLinks AllowOverride All Order deny,allow Deny from all Satisfy all </Directory> <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] </Directory> # Use name-based virtual hosting. NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" ServerName localhost DirectoryIndex index.php </VirtualHost>
Jeff in Seattle
Comments
Very helpful guide
Very helpful post.
I would also like to add that you also may have to set the "AllowOverride" directive to "All" [around line 224 in the httpd.conf file] to allow directives in the .htaccess to work.
Thanks
@shaunak
Thanks so much. I've tried everything under the sun, and it didn't work. Your post led me to this in my httpd.conf:
Options FollowSymLinks
AllowOverride None
Which was overridding every single thing I tried, and I didn't even know it. As soon as I changed None to All, boom, it was working.
With me, it doesn't work somehow
Hello. I did everything as you said in the post.
Since I'm using WAMP I also changed the Document Root from "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" to "C:/Program Files/WAMP/www".
However, the radio buttons on the Clean URLs page remain grayed out. Also the notice "Your system configuration does not currently support this feature. The handbook page on Clean URLs has additional troubleshooting information." remains.
What did I do wrong?
Thank you!
Thank you, Jeff, it worked first time for me! I'd just add that one must not forget to restart Apache to see the difference...
Oliver
Simpler solution
Jeff's solution didn't work on my system, so I started tweaking it, and actually discovered that something much simpler worked fine for me.
In stead of including the extra file I made the changes to the main httpd.conf file.
Since I already had a ton of virtual servers set up on my local machine, this seemed more logical.
I cleaned out most of Jeff's code and wound up with two small changes:
I set AllowOverride=All for this to work at all. If not set, Drupal's .htaccess file (and other .htaccess-files) will be ignored, and it's an important part of the puzzle.
I also made sure that the rewrite module was enabled as Jeff noticed.
Once those couple of changes were made, I restarted Apache and went to /?q=admin/settings/clean-urls in one of my local sites.
It was enabled and it worked once I ticked clean URL's on and saved the settings. I could do the same for all my virtual Drupal-sites with no hassle.
Martin
Wamp on Windows
Jeff thanks for the great solution.
I didn’t work for me thou, but it put me on the right track.
The reason it didn’t work for me was that in my .htaccess file under the following part:
IfModule mod_rewrite.c
RewriteEngine on
I had the option “RewriteBase /drupal” enabled.
As I’m running Drupal from my root I had to change this to “RewriteBase /” (actually I just commented out the entry and uncommented the right one).
And after reloading my Apache service it worked.
Hope this will save someone a bit of headache.
//F
Clean URL is Not running
Hi,
I'm using wamp server in my local system. I want to enable the clean URL , i followed the above instructions but it's not working for me.. It's saying 404 error..
Thanks
Very Helpful.
Thanks!
Yep, this worked for me, although I should point out that I had to do things a little differently.
I didn't have Apache installed before I installed WAMP, so the location of these files was a little different for me. Apache was inside of c:/wamp/bin/apache
Also, the document root inside of the conf/extra/httpd-vhosts.conf file has to be the same as the one in your httpd.conf file. That's probably obvious but it wasn't at 1am last night! Thanks again.
thanks
worked like a charm
Thanks
Thanks a lot, it solved a big problem for me....
Note : the document root inside of the conf/extra/httpd-vhosts.conf file has to be the same as the one in your httpd.conf file
The Solution for me was....
The Solution for me was simpler.... in httpd.conf file I've just need to change AllowOverride None to All, then in drupal folder in htdocs named f.e. drupal6 the .htaccess must be changed. In the section
RewriteEngine ON
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# 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 /drupal6
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
#RewriteBase /
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
And Then everything was O.K.
THanks!!!
Thanks so much. After trying to get clean urls to work for HOURS and HOURs and reading dozens of pages, this finally solved it for me. THANKS!