Forum

URL toolkit

Macka
18 August 2008, 17:33
Hi,
I would like to use URL toolkit in Hiawatha v6.7 for renaming URL addresses. I want to have rule Match ^/mycode/(.*)\.html$ Rewrite /mycode/plane.php?plane_id=$1. It seems to work in wigwam, but in browser I always get 404 error.
What am I doing wrong?

Thanks
Hugo Leisink
19 August 2008, 13:57
If Wigwam shows that the rewriting works, then the problem must be somewhere else. What happens if you directly request /mycode/plane.php? What does the errorlogfile say?
Macka
19 August 2008, 17:06
When I type exactly the same, what wigwam gives me as a translated URL (like /mycode/plane.php?plane_id=something) then I can see the requested page as I want it to see.
Hugo Leisink
19 August 2008, 18:26
You said you are using 6.7. Does the problem also occur in 6.8?

Can you give me the complete rewrite rule you are using?
Macka
19 August 2008, 21:59
Now I am realy confused. I didnt change anything, but it suddenly is working. Maybe a few restarts helped ) I am sorry I bothered you for nothing.
Hugo Leisink
19 August 2008, 23:46
Probably it was a problem with your browser cache. That's a thing that still confuses me from time to time...
regisr
15 September 2008, 00:29
I have the same trouble but it is not a cache issue: I use wget and GET to check it and they have no cache.

I need to add a '?' character at the beginning:
/sample.html => /?sample.html

The rule:
Match /([^\?].*)\.html Rewrite /?$1.html

What is wrong?
Hugo Leisink
15 September 2008, 15:30
Both Hiawatha and Wigwam use the same rewrite library (toolkit.c). So, if your rules work in Wigwam, they should work in Hiawatha. Your rule (which adds the questionmark) results in that the StartFile is requested. Maybe it's this startfile which results in an error.

I've tried your Rewrite rule myself, but it works fine here.
regisr
18 September 2008, 23:03
I have not yet solved my problem!
What is the difference when I type the URL:
http://site/?-page-to-load.html

and

http://site/-page-to-load.html
with the rule
Match /([^\?].*)\.html Rewrite /?$1.html

When the URL don't have a filename before the questionmark what file is called? the default? and how the parameters are transmitted?
Hugo Leisink
19 September 2008, 00:57
In both cases, http://site/ is requested with QUERY_STRING set to "-page_to_load.html". In case of http://site/, Hiawatha will use the StartFile setting (default is "index.html").
regisr
26 October 2008, 11:24
This was a trouble with the StartFile setting.
I don't found how to set an environment variable ( [E=...] with apache) but I used a workaround, passing the value as parameter avec setting the variable in the PHP script..
Now my SPIP site is running. Thanks
This topic has been closed.