Forum Moderators: phranque

Message Too Old, No Replies

Apache htaccess help to RewriteRule

Apache htaccess help to RewriteRule

         

blurtv

7:00 pm on Apr 21, 2012 (gmt 0)

10+ Year Member



Here's what I want to do:

www.mysite.com/video > www.mysite.com/index.php?find=video
www.mysite.com/video/pag/10 > www.mysite.com/index.php?find=video&pag=10
www.mysite.com/video/min/20/pag/10 > www.mysite.com/index.php?find=video&pag=10&min=20
www.mysite.com/video/min/20/pag/10/max/30 > www.mysite.com/index.php?find=video&pag=10&min=20&max=30
etc.

The parameters min,pag,max can be in random order. For example these urls www.mysite.com/video/min/20/pag/10/max/30 www.mysite.com/video/max/30/pag/10/min/20
have to return always: www.mysite.com/index.php?find=video&pag=10&min=20&max=30

I spend all the day without any solutions
Thank you

incrediBILL

7:31 pm on Apr 21, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



As long as the variables video,max,page and min are always present you just need a rule for each combination possible which is a waste of server overhead processing those for no real reason.

Since you're using the path option for variables, think of it like an actual server path, there is only one right path to a file.

Pick a specific path order for those variables and stick with it, it'll make life much easier.

g1smd

8:00 pm on Apr 21, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No. No. No. and again No.

You must have a single URL format that is used on the web. That's the whole point of using friendly URLs.

Additionally, this URL should not be represented by folders. Folder levels mean nothing here.

You should use something like
/p10
and
/p10-m10
and
/p10-m10-x10
and rewrite only these requests.

All other formats and orders
/p10-x10-m10

/m10-p10-x10

/m10-x10-p10

/x10-m10-p10

/x10-p10-m10

should either return "404 not found" or redirect to the canonical format.

Anything short of this will end up with a major duplicate content issue.

incrediBILL

9:58 pm on Apr 21, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Additionally, this URL should not be represented by folders. Folder levels mean nothing here


<edit> Never mind. Gotcha, since it's the type of parameters being used.

g1smd

8:35 am on Apr 22, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



My original reply was to the OP. Wasn't arguing with you bill! I'd had the tab open for more than an hour before I typed a reply. :)

lucy24

10:42 am on Apr 22, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'd had the tab open for more than an hour before I typed a reply.

I thought I was the only one who did that. Hence all those last-minute "overlapping so-and-so" intros because I haven't the energy to go over the whole post for redundancies. (Bill, you didn't really think he was screaming "No, no, no!" at you did you? Even I could figure that one out ;))

But seriously...

Gotta say that
www.example.com/p10-m10-x10

may be friendlier than
www.example.com/index.php?find=video&pag=10&min=20&max=30

but it's still pretty, uhm, numerical-looking. I think I'd go with pg, min, max even if they make the URL a few letters longer.

Are the numbers always multiples of 10 or did you just make those up for the examples?

:: vague mental detour to AppleSoft rule about always numbering by 10s so you will have room to add stuff between lines ::

If they really do all end in 0, you don't need the zeros in the URL at all. You can stick them on in the Rewrite.