XAMPP and mod_rewrite (getting clean URLs to work)

If you're using a CMS or blog app, like Drupal or Wordpress (even if you're not) chances are you'll probably want to enable clean URLs (sometimes called search engine friendly URLs). This cool little feature uses an Apache module called mod_rewrite, and if you're developing your site using XAMPP this is disabled by default (possibly for security reasons).

To enable this module it just takes a little tweak of your http.conf file which will be found in xampp\apache\conf. The conf file already contains the line needed to enable the module, but there is a comment mark (#) just before the code which means Apache will ignore the code. The line you are looking for is:

#LoadModule rewrite_module modules/mod_rewrite.so

In my http.conf file this is line 118, but it may vary so just search for "mod_rewrite" in the file. Now, simply remove the comment (#) from before the line, and save the file. You'll need to restart Apache for the changes to take affect, and you should now find you can use clean URLs with XAMPP.

Please feel free to leave any comments below.

Comments

after this, apache doesn't

after this, apache doesn't start any more...

seems to be more complicated

Make sure you have saved and

Make sure you have saved and closed the http.conf file before restarting as it might remain locked. There's no reason why this would stop Apache working as it's a fairly standard module. Does Apache work when you add the comment back to the line?

If clean URLs still aren't working you can also try setting 'AllowOverride All' to your working directory. Again, you'll have to search for this in your http.conf file, but you may find it referenced several times, so check that you are modifying the correct version. Here is how mine is set:

<Directory "/opt/lampp/htdocs">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

after changes, you must

after changes, you must restart Apache!

u really good!!!im finally

u really good!!!im finally success!!!thanks!!

Thanks!

That was so easy.... Thanks for the tip!

It dont work ! :(

Hi i read all here , i make #LoadModule rewrite_module modules/mod_rewrite.so to LoadModule rewrite_module modules/mod_rewrite.so i saved , i restart xaamp and nothing , i remplace
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
with

Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all

Nothing ! :(( Where i am wrong ??? please help me.... Thanks !

The Error

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500

What OS do you have this

What OS do you have this installed on? The example I used above (for AllowOverride) was for my setup on Ubuntu. I think the directory would be slightly different on Windows, for example.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br /> <br> <h1> <h2> <h3> <h4> <pre> <strike> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
Are you human or do you not compute?
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.