Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite

mode rewrite error

         

Blackguy

3:18 am on Oct 23, 2004 (gmt 0)

10+ Year Member



hello , i was trying 2 make my php/mysql query into static page

i did the first step wich is 2 make :

showcat.php?action=show&cat=xx -->> cat_xx.html

RewriteRule ^cat_([0-9]*).html showcat.php?action=show&cat=$1

but now i have a prob in paging , its not working

i tryed something like this :

RewriteRule ^cat_([0-9]+)_([0-9]+)\.html$ action=show&cat=$1&pg=$2 // not working

RewriteRule ^cat_([0-9]+)\.([0-9]+)\.html$ action=show&cat=$1&pg=$2 //not working

exept if its working and i dont know how 2 call it ..

i tryed cat_xx_xx.html ; cat_xx.html&pg=xx ; cat_xx.html?&page=xx

but nothing want 2 work :o , can someone tell me how this thing work?

Thank's

jdMorgan

12:37 am on Oct 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Blackguy,

Welcome to WebmasterWorld!

For the benefit of our international members, I'd like to ask you to refrain from using phrases like "wich is 2 make" when meaning "which is to make." Also, we like to keep these forums search-engine-friendly, and such slang makes things harder to find. Thanks.

Can you please describe your purpose? It looks like you may be trying to generate search-engine-friendly URLs, so I'm assuming that is what you want to do.

The usual method of making search-engine-friendly URLs is to modify your script to output friendly URLs on your pages. When a visitor clicks on a friendly-URL link on your page and sends a request to your server, mod_rewrite is then used to convert that friendly URL back into a call to your script with parameters passed in the query string.

I'm also not sure about your second group of rules. You'll need to specify the full local-URL-path to the script if you want to pass parameters to it. I *think* something like this would be closer to what you want:


RewriteRule ^cat_([0-9]+)_([0-9]+)\.html$ /showcat.php?action=show&cat=$1&pg=$2 [L]
RewriteRule ^cat_([0-9]+)\.html$ /showcat.php?action=show&cat=$1 [L]

The first rule is invoked if a page number is requested in addition to the category number, and the second rule is invoked if the page number is missing from the requested URL.

If you could provide several examples of the "real" URLs and the desired rewritten URL, that would get you faster, more accurate answers.

Jim