Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/154626-mod_rewrite-_get-issue/
Share on other sites

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]

 

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.