Forum

UrltoolKil rewrites for Drupal

Prit
11 July 2009, 17:47
Hi Hugo,

I just woke up. I have been testing this Drupal site on my hiawatha setup in Puppy linux and it was working great with clean urls. I had used the following rules to enable clean urls. The idea is that if someone uses mysite/home, it should redirect them to mysite/index.php?q=home. But, they don't seem to be working here. Any ideas? You can see http://puppy.prit.us/. Not sure, if its some silly mistake from my side.

VirtualHost {
Hostname = mysite
....
UseToolkit = drupal
}

UrlToolkit {
ToolkitID = drupal
RequestURI exists Return
Match ^(.*) Rewrite /index.php?q=$1
}


Hiawatha version: 6.14
Operating System: Ubuntu 9.04 Server edition
Hugo Leisink
11 July 2009, 20:12
You forgot a small detail. Every URL starts with a slash. So, I think that if you change the Rewrite rule to this
Match ^/(.*) Rewrite /index.php?q=$1

it all should work. The difference is that I added a slash after the Match statement, so it won't be included in the q parameter.
Prit
11 July 2009, 20:36
I tried this change and also removed Hiawatha from the apache proxy. Now Hiawatha is directly serving the pages. It still does not work. I am not sure if its picking up from cache somewhere. Can you check this - http://puppy.prit.us?
Hugo Leisink
11 July 2009, 20:46
Only the Community tab works. You can use 'wigwam -t drupal' to test the toolkit. Does it give you the URL's you want?
Prit
11 July 2009, 21:04
I tried wigwam and this shows the correct urls. One strange thing is when I tried this url, it worked. http://puppy.prit.us//downloads (double slash)
Hugo Leisink
11 July 2009, 21:55
Well, if wigwam shows the right URLs, Hiawatha does what it should do. In that case, Drupal requires something else/more or it is depending on some unknown Apache-only thing.
Prit
11 July 2009, 22:05
I really am not sure where this got messed up. I can bring up my Puppy + Hiawatha VM and am sure it would run fine with all clean urls and the same httpd.conf. Right now, I cannot access the machine. I will check it sometime today and post back.

Prit
11 July 2009, 22:42
Now I have the Puppy + Hiawatha VM running and puppy.prit.us will get you to this site. It works perfectly. The links I tested so far are working correctly. I don't have a clue. Both these are running Hiawatha and have the same thing in VirtualHost config.
Prit
11 July 2009, 23:34
I tried running Hiawatha through apache proxy again and added the Hiawatha port 8080 to the Drupal settings file and now it seems to be working. I checked the links and they are working. Thanks Hugo.
Prit
12 July 2009, 08:31
What I finally did is to reinstall Ubuntu 9.04 clean to a new VM and added Hiawatha 6.15 and redid the site. Now everything works great. Maybe I messed up something on the last VM. Thanks for your help Hugo.
Hugo Leisink
12 July 2009, 10:57
Oke. That's weird... But good to hear that everything works oke now.
Hugo Leisink
13 July 2009, 00:31
Are you sure all works fine now? When I visit your website, the stylesheets are missing....
Prit
13 July 2009, 07:15
Yeah. It worked yesterday. When you keep experimenting, things get messed up. . Moreover we keep discussing about the website and I personally am not satisfied with Drupal. Maybe its a problem with our setup or some modules we are using. It takes a long time to load and has got suspended due to CPU usage by the host multiple times. So we are considering building static front end with some dynamic parts displaying here and there. Do you have any recommendations?
Hugo Leisink
13 July 2009, 09:25
Well, to be honest, I really hate Drupal. Have you ever looked 'under the hood' of Drupal? The core code is really really ugly. I even think that Drupal is dangerous. I used to work as a freelance webdeveloper and worked for a company for a few months that created websites with Drupal. My own website from my server at home loaded faster than the Drupal website that was stored locally on my development machine!!!! I did some testing on Drupal. I placed a counter on the database query routine. On a simple page that showed a list of 15 items, Drupal needed more that 400 database queries. More than 400!!!!!! Another ugly thing about Drupal are the hooks. Every page can place hooks in any other page. The result is that when one page failes to load because of an error, all other pages that have hooked that failing page fail too. That's so nice when you work on a website with more than one developer..... not!

My recommendation: stay away from Drupal!!!!!
Prit
13 July 2009, 10:02
Thanks Hugo. I enabled the devel module in Drupal that displays various stats. I found the same thing that you mentioned. Around 400-500 SQL queries to load a single page for a single user. We have 300,000 visitors a month. Its a miracle that we are still on shared hosting. We will be moving anytime. I ran it on a quad core actual production server and it was using almost 30-40% cpu for 1 user for 1 page. Having been using Puppy for a while, anything that is so huge and bulky - I try to stay away from it.

I hope we will be soon moving away from it. Do you know other CMS's that might be efficient/lightweight?
Hugo Leisink
13 July 2009, 11:29
I've heard good things about CakePHP [cakephp.org]. Pro: It has a good design and is well documented. I've never tried it myself, though. Con: it's a framework, not a CMS.

What you also can try is my own framework/CMS called Banshee. Pro: secure, fast and modular design. Con: project still lacks good documentation, but I'm here to help. For a Banshee demo, see http://www.hiawatha-webserver.org/banshee.
Prit
14 July 2009, 01:28
I will try Banshee. I always like trying new stuff.
O. B. Server
9 November 2009, 06:02
FWIW, drupal 6.14 is up and running on my Hiawatha v6.16 installation on Puppy 4.2
Martin Eskdale Moen
8 April 2010, 23:14
I have an issue in this part myself.
In the rewrite Drupal provides they check to see if the request is a file or a directory, how can I do this in regards to the hiawatha rewrite?
Thanks

What drupal wants:
<Directory /var/www/example.com>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>


What I have made for hiawatha:
UrlToolkit {
ToolkitID = drupal
RequestURI isfile Exit
RequestURI isdir Exit
RequestURI exists Return
Match ^/(.*) Rewrite /index.php?q=$1
}
Martin Eskdale Moen
8 April 2010, 23:16
Sorry, I did not say what the issue was, it is not actually working, the wigwam tells me that it rewrites:

url: /site/default/files/test.png
new: /index.php?q=site/default/files/test.png


However as far as I can understand it should be:
url: /site/default/files/test.png
new: /site/default/files/test.png


Thank you
Hugo Leisink
9 April 2010, 01:16
Since you are only testing the part that comes after the hostname, Hiawatha knows no hostname, and therefor no document root, when testing an URL toolkit rule via Wigwam. Try testing the rule via Wigwam with the document root of your website as the current directory.
Martin Eskdale Moen
9 April 2010, 09:23
I did however push this on to my development server and I did not get any further with it, it still passes the file requests to the index.php file. I will try that with wigwam
This topic has been closed.