Jump to content

Changing PHP file name


graham23s

Recommended Posts

Hi Guys,

 

I'm sorry if this is the wrong section, what i am trying to so is:

 

currently all my products on my ecommerce site look like:

 

productid=1234

 

i was trying to change it so the actual product name is show:

 

product-name-for-id-1234

 

is there any tutorials on how i would best go about this?

 

thanks for any help guys

 

Graham

Link to comment
Share on other sites

This is archived by mod_rewrite. However it cannot convert your product ids to your actual product names. You'll have to modify your script so it works like so

 

product.php?id=product_name_here

 

Now with mod_rewrite you can do

RewriteEngine On
RewriteRule ^([a-z0-9_-]+).html$ product.php?id=$1

So when you go to http://yoursite.com/product_name.html it'll actually be calling product.php?id=product_name

 

mod_rewrite tutorial

Link to comment
Share on other sites

Hi Guys,

 

thanks for that i understand better now, the way my site is setup i use id's like:

 

product.php?id=1

 

instead of the actual product name like:

 

product.php?id=product_name_here

 

Does that make it any harder for me, or does the same basic rules apply like above?

 

thanks guys

 

Graham

 

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.