regdude Posted October 15, 2008 Share Posted October 15, 2008 Hi! I have been noticing that many websites have this kind of a URL: http://web.com/user/someone123 Wanted to know what is this thing called? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 15, 2008 Share Posted October 15, 2008 This is archived using mod_rewrite Quote Link to comment Share on other sites More sharing options...
regdude Posted October 15, 2008 Author Share Posted October 15, 2008 Isn't this possible with other HTTP servers? like lighttpd? it also has mod_rewrite. And isn't this dangerous to use mod_rewrite? As I remeber there was a remote exploit using this module. Quote Link to comment Share on other sites More sharing options...
trq Posted October 15, 2008 Share Posted October 15, 2008 Yes, Lighttp has a mod_rewrite implimentaion. Being open-source software whatever expliots are found are generally patched within hours. Quote Link to comment Share on other sites More sharing options...
regdude Posted October 15, 2008 Author Share Posted October 15, 2008 Ok, I did a simple thing, products.php: <?php echo $_GET['id']; ?> .htaccess: RewriteRule ^/products/([0-9]+) /products.php?id=$1 When I enter http://localhost/products/1 - it should return value 1, but it doesn't. Btw, is it safe using this way? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 15, 2008 Share Posted October 15, 2008 Btw, is it safe using this way? It as safe as the original url. All you're doing is making your urls cleaner. You still need to sanitize your data as you would normally. As for why its not working remove the caret symbol ^ from your rewrite rule: RewriteRule /products/([0-9]+) /products.php?id=$1 Quote Link to comment 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.