Modrewrite Help Please :)

Posted By: suthra ()
Posted On: 2006-May-29 10:45

Iam trying to redirect
domain.com/classified/subadsresult.php?AT=1&SUBC=8&category=computer&subcategory=computer-games&start=1

To:
domain.com/classifieds/computer/computer-games/181.html

I tried this code:

RewriteRule ^classifieds/[^/]+/[^/]+/[^/]+[^/]+[^/]+.html$ /cassified/subadsresult.php?CAT=$5&SUBC=$4&category=$1&subcategory=$2&start=$3 [L]


The value is not called in the pages properly.
Iam not a tech guy, i learnt something by reading forums like this

Please help on this issue smile.gif

Thanks.,
Sarathy.s


Posted By: Prowler (Staff)
Posted On: 2006-May-30 09:14

I have been saying this many times over in this forum - Check your RegExp statements using a Perl 'evaluator' before you add to the Mod_rewrite directive.




Posted By: Silv ()
Posted On: 2006-Jul-28 18:51

I'm very very fond of The RegEx Coach ... freeware that helps to check RegEx for you. Still takes a bit of work to get things right, but Prowler's right - it's much easier when you've got something to tell you if you're barking up the wrong tree.


Posted By: philh ()
Posted On: 2006-Jul-28 18:55

I,m not at all techie, just an old designer that learned SEO - but I did notice this today:

[link]

I don't know if it's relevant but check it out anyway. HTH

If it is important could someone more technical than I start a thread please?


Posted By: Prowler (Staff)
Posted On: 2006-Jul-29 06:45

Thank you philh for the link.

mod_rewrite is addressed as the Swiss Army Knife when it comes to extending the functionality of the Apache servers. It can do a lot of things with minimal fuss or adding thousands of lines of code.

But it is a double edged sword as well if you are careless with your directives. Sometimes you can bring the server down to its knees with a contrived unending loop.
Bad elements could engineer artificially contrived requests to trigger the vulnerability if your statements are not crafted well enough. In a typical worst case scenario, your server goes into a loop, consuming resources to the point of crashing the server.

Most server admins know this and this is one of the major reasons your host will dump your site.

Fortunately, the required skill to invoke a runaway loop is high and the common script kiddies do not have the wherewithal to trigger one anytime now. Still that does not mean that you can be sloppy in coding.

Some time ago we had spent months working on a content delivery engine which depended on a 404 Error trap and a lengthy mod_rewrite set of directives. The 'engine' worked flawlessly in the development servers and even under beta testing in the production servers. Then someone added just one page of content which brought the servers down. It is the not page which triggered the disaster, but one embedded URL with an accented character. The input module was not adequately sanitized. It is just an example of working with a double edged sword.