the182guy Posted June 17, 2010 Share Posted June 17, 2010 I want to rewrite this sample url: [integer]_any-seo-text-here.html to test.php?id=[integer] Example 99_contact-us.html -> test.php?id=99 Here's what I have: RewriteCond %{REQUEST_URI} ^\d+_(.*).html$ RewriteRule ^(.*)_(.*).html$ test.php?id=$1 [L] It works if I remove the condition, but then it rewrites regardless of the integer being there like: sometext_contact-us.html <- I don't want this to rewrite I only want to rewrite if the first part (before underscore) is an integer, and the extension is .html Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/205066-simple-rewrite-condition-and-rule-but-not-working-int_anytexthtml/ Share on other sites More sharing options...
the182guy Posted June 17, 2010 Author Share Posted June 17, 2010 I seem to have it working without a condition rule, just this RewriteRule ^([0-9]+)_(.*).html$ test.php?id=$1 Quote Link to comment https://forums.phpfreaks.com/topic/205066-simple-rewrite-condition-and-rule-but-not-working-int_anytexthtml/#findComment-1073496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.