N-Bomb(Nerd) Posted November 30, 2009 Share Posted November 30, 2009 Hi, I have the following: .htaccess: Options +FollowSymlinks RewriteEngine On RewriteRule ^(.*)$ index.php?id=$1 Index.php: <?php echo $_GET['id']; ?> Except when I do http://mywebsite.com/3f23j89 it just prints "index.php" on the page.. instead of whatever I typed after the slash.. When I change "^(.*)$" to "^([0-9]+)$" though.. it will display numbers.. why can't I do all digits? Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted November 30, 2009 Share Posted November 30, 2009 try this RewriteRule ^([^/-]+)$ index.php?id=$1 Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted November 30, 2009 Author Share Posted November 30, 2009 try this RewriteRule ^([^/-]+)$ index.php?id=$1 It's just showing "index.php" Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted November 30, 2009 Share Posted November 30, 2009 what about when you doe this RewriteRule ^([^/-]+)$ /$1 Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted November 30, 2009 Author Share Posted November 30, 2009 what about when you doe this RewriteRule ^([^/-]+)$ /$1 With that I just get a 404 not found Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted November 30, 2009 Share Posted November 30, 2009 one more time and I am out of ideas RewriteRule ^/([^/-]+)$ /index.php?id=$1 Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted November 30, 2009 Author Share Posted November 30, 2009 one more time and I am out of ideas RewriteRule ^/([^/-]+)$ /index.php?id=$1 Nope. :-\ Quote Link to comment Share on other sites More sharing options...
N-Bomb(Nerd) Posted November 30, 2009 Author Share Posted November 30, 2009 Got it working with: RewriteRule ^([^/\.]+)/?$ index.php?id=$1 Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted November 30, 2009 Share Posted November 30, 2009 RewriteRule ^([^/-]+)$ /index.php?id=$1 I use it like this RewriteRule ^product-([^/-]+).html$ /products.php?colID=$1 [NC] where it takes product-$var.html and changes it to products.php?collID=$var for the server and that works flawlessly, i would assume the above would work similarly. Quote Link to comment Share on other sites More sharing options...
dragon_sa Posted November 30, 2009 Share Posted November 30, 2009 great to hear 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.