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 https://forums.phpfreaks.com/topic/183385-not-working/ 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967966 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967969 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967970 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967971 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967976 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967980 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967983 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967986 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 https://forums.phpfreaks.com/topic/183385-not-working/#findComment-967988 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.