Forums Joomla!

Problems Using Apache mod_rewrite

Subscribe to Problems Using Apache mod_rewrite 9 post(s), 3 voice(s)

 
Avatar Greg_NST 5 post(s)

Greetings all…

First off, I love Bitnami. Thanks to your product, I was able to get a backup website up and running in a matter of hours. This may not seem very impressive, but trust me, up until yesterday, when I heard ‘Apache’, I thought of the Lone Ranger.

Now, I’m in a truly enviable position. Our company’s website is back up and running, so my emergency backup is no longer needed. However, servers do go down, so we want to get our ‘backup’ site to look and behave precisely the same way as our regular site. Everything is perfect except for one rather troubling problem.

Our regular site successfully uses Apache’s mod_rewrite function.
The site that I put up can’t do. Consequently, I end up with an index.php string in between my main directory and the page I try to link to.

When I change the relevant radio button (in Joomla Global Configuration) to ‘yes’, I can only access my index page. Every other page I try to access gives me a joomla/____ can not be found.

Here are the steps that I have taken to fix this problem:

1. I have renamed htaccess.txt to .htaccess using Windows command line.
2. I have searched high and low and read everything I could find. Consequently, I have edited httpd.conf in apache2/conf to include

AllowOverride All

In httpd.conf, I noticed that the command to initialize mod_rewrite was commented out. I removed the # to see if that made a difference. No luck.

I have been through .htaccess and, while everything was identical to the .htaccess file on the server that works, I tried removing the # in front of RewriteBase / and even tried entering Joomla after the slash. Still no luck.

3. After doing some more reading, I found a Drupal tutorial that suggested I go into confs/drupal.conf and set “AllowOverride All”. Thinking ‘what the heck have I got to lose?’, I tried doing that with Joomla and still had no luck.

I should note that, after making each of these changes, I stop the process and then start it up again via Program Files -> Bitnami….. in Windows Server 2003.

So, here is where I am. I have tried everything I can think of and/or find online and have had absolutely no luck. Basically, I’m at my wits end and am about to consider making some form of sacrifice to the gods of Joomla and Apache…..

I have two questions:

First, does anyone have another suggestion for something I could try?
Second, if this doesn’t work, what should I sacrifice? =)

By the way, I’m aware that this question almost certainly belongs in the regular Joomla forum, but I thought that putting it here might help some neophyte Bitnami-ers who have run into similar problems.

Thank you for your help (and for reading this rather long post)

 
Avatar antonio Administrator 524 post(s)

Hi Greg,

If I am correct, to enable mod_rewrite for Joomla!, you need to:

  • Modify <installation_path>\apps\joomla\conf\joomla.conf and change “AllowOverride” directive to “All”
  • Modify <installation_path>\apps\joomla\htdocs\htaccess.txt and change

# RewriteBase /

to

RewriteBase /joomla

  • Rename <installation_path>\apps\joomla\htdocs\htaccess.txt to <installation_path>\joomla\htdocs\.htaccess

That’s for enabling the rewrite of urls the easy way. Now, to debug the error, please put the contents of the file <installation_path>\apache2\logs\error.log

Cheers

 
Avatar Greg_NST 5 post(s)

Hi Antonio….

First off, thank you so much for your help. I’ll find a way to pay you back one day!

Attached are the contents of the error.log. I made the changes you specified and turned on mod_rewrite in global configuration between 09:14 and 09:17. When I tested the site, the log recorded the following error @ 09:17:23:

 
Avatar Daniel Lopez Administrator 113 post(s)

Hi,

Can you go to :

C:/Program Files/SmartSwipe Web Site/apps/joomla/htdocs/faq

and see if that directory does indeed exist?

 
Avatar Greg_NST 5 post(s)

Well, this is embarassing….

I figured out my problem and, as always, the most simple possible cause was actually THE cause. I took a look in httpd.conf and discovered that the following line was # out…..

LoadModule rewrite_module modules/mod_rewrite.so - Hmmmmmmm…....=)

Anyways, I removed the #, and now, mod_rewrite works perfectly.

Antonio and Daniel – I owe you both huge amounts of gratitude. If you are interested, I would be glad to write a document (written for dummies – like me) that outlines all the steps to follow to enable mod_rewrite under the base installation of the Bitnami 1.5.6 Joomla stack. In fact, feel free to pass off any kind of documentation project to me – I think that Bitnami might become something of a hobby.

 
Avatar antonio Administrator 524 post(s)

We are glad to hear that you finally got it working :) Of course, every contribution is welcome, so feel free to contact us anytime via info <at> bitnami <dot> org

Cheers

 
Avatar Greg_NST 5 post(s)

Greetings….

I’m almost finished a document on enabling mod_rewrite with a base installation of Bitnami. If all goes well (nothing ever goes well),
I should have a completed document eMailed to you by the end of this weekend. Then, you’ll have my personal eMail address and you can
start sending me assignments – I’m Canadian and our winters are very cold, so I need a nice indoor hobby. Writing is one of my great passions, so I
might as well be somewhat useful in my rather limited spare time! :-)

As it stands, I’ve got a document written that will let a user remove the index.php from URLs under a base installation of the Bitnami Joomla stack. So, with the information I have now, I can get a user’s URLs into this format:

www.mydomain.com/joomla/page

(note – Since www.mydomain.com will point to the index.html file in <installation path>apache2/htdocs, I also wrote a short little section on how to turn that file into a redirect, so that typing in www.mydomain.com will redirect a user to www.mydomain.com/joomla)

For the sake of overall user-friendliness, I’m interested in taking this document one step further. The /joomla subdirectory is okay for some users,
but quite annoying for others. It strikes me that Bitnami’s target market is interested in putting up a professional website with as little
trouble as possible. Therefore, I’m curious in whether I can further rewrite URLs so that instead of

www.mydomain.com/joomla/page
www.mydomain.com/joomla/faq

the URLs will be

www.mydomain.com/page
www.mydomain.com/faq

I’ve tried making a few changes in .htaccess to make this happen, but I’m not having any luck. This makes sense since, under
the base installation of Bitnami, the .htaccess file is located in the /joomla subdirectory. If what I’ve absorbed is true, I can’t get rid of
a subdirectory using .htaccess if .htaccess is located ‘in’ the offending subdirectory! Rather, it should be placed in the root directory.

So, I have two questions.

1. I assume that the ‘root directory’ would be <installation path>/apache2/htdocs. Is this correct? And, if so, could I put an .htaccess file in that directory to
get rid of the /Joomla subdirectory? What should that .htaccess file contain so that it accomplishes the rewrite without causing conflicts
with the other .htaccess file in the /joomla subdirectory?
2. Second, could I install Joomla directly into that base directory and avoid having to use .htaccess to rewrite the URLs? The joy of Joomla and Bitnami is that this would presumably just take a cut/paste, then some changes to a few configuration files.

If you can give me some guidance on this, I will gladly test it on my installation and get this figured out. I should warn you – if I am left to my own devices, Bitnami is going to have books and books worth of documentation :-)

Be peaceful and thank you very much

Greg

 
Avatar Greg_NST 5 post(s)

I played around on my own and got it figured out. I’ll fully document my solution as soon as I have a day off (and figure out what exactly I did) :-)

 
Avatar antonio Administrator 524 post(s)

Great! Thanks Greg

Cheers

Forums Joomla!