avvllvva Posted April 18, 2009 Share Posted April 18, 2009 This is my url ..../product.php?id=99&title=demo rewrited url is ....../product/id/99/title/demo And my .htacces content is following RewriteEngine on RewriteRule product/id/(.*)/title/(.*) product.php?id=$1&title=$2 The problem is, $_GET['id'] and $_GET['title'] giving empty results... please give me a solution , how to get the GET variable values...... Thnx in advance Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/ Share on other sites More sharing options...
avvllvva Posted April 19, 2009 Author Share Posted April 19, 2009 After this mod_rewrite I have got a seo friendly URL. But, the values passed through the url is not getting.......... any guess............ how to get this ? Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-813608 Share on other sites More sharing options...
.josh Posted April 19, 2009 Share Posted April 19, 2009 I'm a noob at mod rewriting, so forgive me if I'm being ignorant here, but don't you have the pattern/$n backwards? as in, doesn't it need to be like RewriteRule product/id/$1/title/$2 product.php?id=(.*?)&title=(.*?) Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-813621 Share on other sites More sharing options...
soak Posted April 19, 2009 Share Posted April 19, 2009 Nah, was the right order first time. Is it even loading the php page? If you var_dump($_GET) what do you see? You could try this: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^product/id/(.*)/title/(.*)$ /product.php?id=$1&title=$2 [L] Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-813626 Share on other sites More sharing options...
avvllvva Posted April 19, 2009 Author Share Posted April 19, 2009 hi soak, sorry, no luck with your .htaccess code. And the page is loading with other contents but its giving array(0) { } with the var_dumb, same as before.. Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-813659 Share on other sites More sharing options...
soak Posted April 19, 2009 Share Posted April 19, 2009 I've just tested on apache and that worked correctly for me. http://example.org/product/id/1/title/blah produced: array(2) { ["id"]=> string(1) "1" ["title"]=> string(4) "blah" } When I var_dump'd $_GET Is your product page in a subdirectory? Any errors in your server logs? Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-813671 Share on other sites More sharing options...
avvllvva Posted April 20, 2009 Author Share Posted April 20, 2009 no, its in root directory (both .htaccess & product.php are in same directory). And I have no access to the server logs, do u know any other method to get server logs? Quote Link to comment https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/#findComment-814287 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.