maz.net.au

Maz

Warning! Camera related content ahead!


mod_rewrite lesson learning.
In category Site on 15 Dec 2005 @ 06:45 pm
I'm still attempting to seamlessly change my site across to a dynamic themeing system and have hit a brick wall. Any HTTP GET variables are 'eaten' by mod_rewrite and when I send it to the template page it doesn't get sent on. I.e. if I wanted to go to Lisa's journal I'd normally put http://maz.net.au/index.php?user=lisa or something that would be rewritten to that except when i try to redirect that again to template.php?file=index.php&user=lisa the "?user=lisa" gets stripped off the original url and I can't get to it to pass to the template.php file.

RewriteRule (.+\.php)/?\??(.*)$ template.php?file=$1&$2 [L,NC]

And that just doesn't work. Hints and suggestions please!
Try:
RewriteRule ^template\.php.* - [L]
RewriteRule ^(.+)$ template.php?$1 [L]
and handle everything in PHP. There are several functions which treat strings as various types of queries and parse them accordingly.
Comment by thei on 15 Dec 2005 @ 07:47 pm
http://the-i.org/
dont use mode_rewrite i have a .net script i willemail to you 16MB
Comment by Kieran on 15 Dec 2005 @ 11:24 pm
Maz...

I don't know for sure (and someone will bag me out here now for this...) but I know that in bash you have to export your variables... is this a requirement of PHP? I have read a fair chunk of PHP in my time, but i could never write it.

Try talking to a mate of mine (kussie here) and seeing what he says...
edit by: Maz
Comment by Smeags on 16 Dec 2005 @ 01:58 am


Valid XHTML 1.0 Strict Valid CSS! Powered by PHP No Database

Menu




Powered by:
Powered by MOSS