Using GET with mod_rewrite on

The problem is that I am trying to use a get method (or post, doesn't matter to me really but I do like having the information in the URL better than not) but it seems mod_rewrite is preventing that from working, it just changes the URL so no form information is actually passed.
Is there a way around this? Or is there perhaps someone who is willing to give me some help customizing the rewrite rules in htaccess a bit?
I've tried going through tutorials about it but it's so much easier if someone helps.
Thanks!

Comments

  • trisweb Administrator
    Where are you trying to do it? It might be better to use a GET request for the ZP page if you just redirect back or something anyway.

    Also, there's an option, QSA for mod_rewrite rules that appends the query string. Zenphoto currently does not use it :-( But I thought it worked anyway! I do it with the AJAX (it just submits a GET request with the current URL appended with ?whatever=stuff) so it should work... are you sure you're doing it right?
  • I'm trying to do it on the album pages of my background websites. The album pages are pretty much outside of zenphoto, as far as the images displaying goes anyway. So that means that I can append the query string of that page easily, so I just want to have little dropdowns where users can order the results and filter them by resolution (exactly the same as here http://www.dualmonitorbackgrounds.com/themes/dmb/search.php )
    I'm pretty sure it's working, yeah. Because I wrote the code and it didn't work so I turned off mod_rewrite in the config file and it worked perfectly.
    Pretty sure I'm doing it right, I've hardly modified htaccess. Here is my htaccess in case I have screwed something up:

    `ErrorDocument 404 /error404.php

    RewriteCond %{HTTP_HOST} ^triplemonitorbackgrounds.com

    RewriteRule ^(.*)$ http://www.triplemonitorbackgrounds.com/$1 [R=permanent,L]



    RewriteEngine On

    RewriteBase /

    RewriteRule ^admin/?$ zen/admin.php [R,L]

    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]

    RewriteCond %{REQUEST_FILENAME} -d [NC]

    RewriteRule ^.*$ - [R,L]

    RewriteRule index.php$ index.php [L,QSA]

    RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]

    RewriteRule ^page/([A-Za-z0-9-_]+)/?$ index.php?p=$1 [L,QSA]

    RewriteRule ^(.*)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]

    RewriteRule ^(.*)/image/(thumb|[0-9]{1,4})/([^/\]+)$ zen/i.php?a=$1&i=$3&s=$2 [L,QSA]

    RewriteRule ^(.*)/image/([^/\]+)$ zen/i.php?a=$1&i=$2 [L,QSA]

    # Catch-all - everything else gets handled in PHP for compatibility.

    RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]

    `

    Thanks for your help

  • trisweb Administrator
    Ah, I am doing QSA! And that's why it should work. Good!

    So, maybe you just need to get the URL right, I'm not sure... but it should just append the query string right after the rewritten path... can I see the page that's trying to do this? [Edit: nevermind, I see it... looking now]
  • trisweb Administrator
    Ahhhh, I see the problem... it's the internal rewriting that's botching things. It's trying to turn that string into an album name, and then it can't find it, so it throws that error. Looks like you'll have to leave the mod_rewrite off that page... ah well. Should still work fine.
  • Hmm but isn't it possible to just add some to htaccess that makes it recognize it? I've tried looking at tutorials but nothing I've found explains how L,QSA works... I'll look again
  • This must seem like a silly question to you but why wouldn't this work?

    `RewriteRule ^([A-Za-z0-9-_]+)/orderby/([0-9]+)/$ index.php?album=$1&orderby=$2 [L,QSA]`

    Or something like that anyway
  • trisweb Administrator
    Because of bugs in mod_rewrite (and because they're distributed in millions of Apache servers around the world, and thus can't be easily fixed) Zenphoto does the parsing of the strings internally, in PHP, so that also would need to be changed in order to allow for a different rewrite structure...

    I need to recode the internal rewrite to be more flexible, right now it's essentially hardcoded, so I'm sorry about that.
  • Ah okay, fair enough. Can you tell me where the PHP code is? It will probably be a waste of time for me to look at it but I can give it a try.
    I just think it would be such a cool feature, for people to be able to filter and sort things live on the album pages, but I rely on Google for hundreds of my visits per day so it isn't really an option for me to turn mod_rewrite off.
Sign In or Register to comment.