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
https://forums.phpfreaks.com/topic/155738-changing-php-file-name/
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

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.