Jump to content

[SOLVED] Product ID Question


linstefoo

Recommended Posts

If you go to my clients website: http://www.everythingdunes.com and hover over a product link, you get the normal "products.html?pid=##". What I would like to do is make that turn into something like this: "product-##.html" and have it bring up that product's information, while still referencing products.html as it's template. An example of what i'm talking about is at:

 

http://epenguins.mobilepenguins.com/product.html ( the template without the product info )

http://epenguins.mobilepenguins.com/product-15.html ( what i'm trying to do )

 

Link to comment
Share on other sites

Tried all of these and thanks for the help, but it just doesn't seem to be working :(

EXAMPLE:

http://everythingdunes.com/product-1.html

 

Here is exactly what I use in my .htaccess file:

RewriteEngine On

RewriteRule ^([^/?]*).html$ /index.php?%{QUERY_STRING}&page=$1 [PT,L]

RewriteRule ^product-([0-9.]+).html$ /index.php?page=products?pid=$1 [L]

 

Am I doing something wrong?

 

Link to comment
Share on other sites

try this:

RewriteEngine On
RewriteRule ^([^/?]*).html$               /index.php?%{QUERY_STRING}&page=$1               [PT]
RewriteRule ^product-([0-9.]+).html$       /index.php?page=products?pid=$1 [L]

I removed the first L, because it means last and stops anymore rewrites from happenning. Not sure what PT means though..

Link to comment
Share on other sites

I found that it is conflicting with the original mod-rewrite. I realized that I can rewrite it to look like so, it works:

RewriteRule ^product-([0-9]+).htm$      /index.php?%{QUERY_STRING}&page=products&pid=$1  [L]

 

Thanks to all of those who helped and thank you Dragen for suggesting the mod-rewrite conflict.

 

Link to comment
Share on other sites

something that you could do which may work (and enable the first re-write to work as well) is simply switch the order they're in so:

RewriteEngine On
RewriteRule ^product-([0-9.]+).html$       /index.php?page=products?pid=$1
RewriteRule ^([^/?]*).html$               /index.php?%{QUERY_STRING}&page=$1 [PT,L]

Otherwise I think you'll find your page link ending in .html will not work.

 

 

EDIT: actually nevermind that. What you've got should work because of %{QUERY_STRING} I think..

Link to comment
Share on other sites

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.