Short bio
Hi! My name is Dan and I'm a Systems Manager and Web Developer from the UK. I blog about web technology and digital lifestyle. You can follow me using the links below. Thanks for dropping by.
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 httpd.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 httpd.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 httpd.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.
Mac OS X
In Mac OS X the path to the httpd.conf file (yes the name has a 'd' in it) is /Applications/xampp/etc/httpd.conf but unfortunately this didn't solve my problem as it was already uncommented.
Thanks, the file name above
Thanks, the file name above has been amended :)
As for getting this working on Mac OS X, I found a site which says you may have to to perform one extra step:
http://rexselin.wordpress.com/2006/07/28/making-mod-rewrite-and-htaccess...
Hope this helps
In development laptop
I have set my httpd.conf file is all set. My problem is with the .htaccess file running in a windows machine.
It will not work.
.htaccess file;
ErrorDocument 403 /cms_directory/index.php?do=/public/error/403/
ErrorDocument 404 /cms_directory/index.php?do=/public/error/404/
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cms_directory/file/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/install/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/design/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/plugins/.*
RewriteRule ^index.php(/.*)$ /cms_directory/index.php?do=$1 [L]
RewriteCond %{REQUEST_URI} !^/cms_directory/file/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/install/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/design/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/plugins/.*
RewriteCond %{REQUEST_URI} !^/cms_directory/index.php
RewriteCond %{REQUEST_URI} !^/cms_directory/robots.txt
RewriteCond %{REQUEST_URI} !^/cms_directory/favicon.ico
RewriteRule ^(.*)$ /cms_directory/index.php?do=/$1 [L]
What am I doing wrong? the links do not work and are not being directed to the correct part of the script.
Have you restarted Apache
Have you restarted Apache since you made the change to the httpd.conf file? Also, if you run php_info(), is mod_rewrite showing in the loaded modules?
Thanks
Dan
more of the same
Hi Everyone,
Sorry to hijack this thread, but I am getting impatient and borderline desperate... I am reposting a post that I made in the Apachefriends forum earlier this morning...
***************************************************
I am a relative noob to the Linux world but am in the process of building a website for the 1st time and recognize the advantages of running it on a Linux server.
I am still in the Development phase using Joomla 1.5.21 as my CMS. Under windows I was using Xampp because it was easy to install and I knew I had a lot of work ahead of me.
4 or 5 months later I have a site working using several Joomla components; among others, Googlemaps, K2, Kunena, Joom Gallery,CBE, etc... My wife is on my case to start work developing her website as well, so I knew it was time to learn how to migrate my site.
After several days of tinkering and such, toying with the idea of changing linux distro's, reading thread upon thread of Debian vs Ubuntu, i made the switch from Ubuntu 10.04 desktop to server 32bit edition. I dealt with the nvidia graphics issues, I am successfully dual booted with Windows boot manager (I am running Windows xp home & Windows server 2003 on that side... network webhosting project that I will tackle later.)
After enduring that trial by fire I was ready to setup xampp on linux. I am using version 1.7.3a I faught with permissions and error reporting errors for awhile, I couldn't get the config.php file or whatever it is called to rewrite & had a PHP.ini issue with displayin errors, pretty standard stuff, I fixed all this and exported my joomla site database from my sql, imported it and now was ready to import my content items , modules, components, plugins, photos,etc and did so by manually copying the data. The Template manager recognizes the modified css and the logo and images are present, there is something like 155 mb in my joomla site's directory and it is in Htdocs like it is supposed to be.
I have been reading lots about enabling a rewrite module for apache2 but I am getting a little bit frusterated and I am hoping for some suggestions on where to find it, deal with it, and in the end start working on the content side because I am a little out of my element right now. Help.... please.
****************************************
Anyhow on to my question I have made the prescribed changes to Httd.conf file and the htaccess.txt files... am I barking up the wrong tree here? All I want to do is start working on my site in a linux environment, I figure I shouldn't have to reinstall all the mods and this should be somewhat simple... what am I missing? Please help me... someone...
Hi Sharpy As far as I
Hi Sharpy
As far as I remember setting up XAMPP on Linux (in terms of the Apache configuration) is pretty similar to setting it up on Windows (apart from, of course, the directory structure and such). Is the issue that you can't get XAMPP running on Linux or is it that you can't get mod_rewrite (clean URLs) enabled on your Linux XAMPP setup? The site itself (Joomla) should be platform independent, so it should run just the same on Windows as it will on Linux or Mac as long as they are running Apache, PHP and MySQL configured properly with the required modules.
Thanks
Dan
and yes I have restarted apache
....
On by default
Hi Dan,
Just downloaded the latest version (1.7.3) and mod_rewrite seems to be on by default.
Pity because I hoped it was my issue as I can't get my Joomla sites to display properly on my xampp config. Almost seems like the template folder is missing(it isn't).
Cheers
Gary
Not working my xampp rewrite!
hello.
i have installed xampp on windows.
i am changed
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
and
Options FollowSymLinks
AllowOverride none
Order deny,allow
Deny from all
to
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
and restarting my apache but still not work please tell me what we do.
i am a developer on http://www.dotiv.com site and i am changing my site on localhost but this is very big problem to me please give us advise Thanks.
.htaccess
I had the same issue as you are indicating. After some investigation it was due to a non supported command in the .htaccess file.
I had to uncomment the EpiresActive line as follows:
# ExpiresActive On
After this, my issue was solved ! :-)
Thanks for the tip, David :)
Thanks for the tip, David :)
That worked
Thanks that worked and I reference you in my blog: http://compileyouidontevenknowyou.blogspot.com/2012/02/xampp-on-osx-word...
Great stuff!
That's great - glad it helped
That's great - glad it helped :) Thanks for the link
Dan