Pretty Urls (htaccess file?)

Erm, OK, so doesn’t that mean that it’s working then?

Sorry,

I meant the link doesn’t work. Whenever I insert the name with hyphens this link doesn’t work.

Can you post an example of a link that doesn’t work for you?

Hi,

I have tried both of these

.co.uk/products/product/clearance—hatherley-high-gloss-2-drawer-bedside-chest-in-walnut-and-red/6550

.co.uk/products/product/6550/clearance—hatherley-high-gloss-2-drawer-bedside-chest-in-walnut-and-red

That’s really strange. I’m using the same .htaccess as I posted earlier, and the link works fine for me… it passes through the product ID with no problem.

Hi,

Its very strange. I deleted everything from the htaccess file so it was blank it and it had no impact on my site. The 404 page even appeared.

For sure, without the rewrite rules then the product URL just wont work.

If you put the contents of .htaccess back, and put var_dump($_GET) back at the top of product.php and try the URL again, what do you get now?

Hi,

This is what echoes when I visit the page without the product name in the link.

array(15) { ["product_id"]=> string(4) "6550" ["id"]=> string(9) "721268544" ["link"]=> string(57) "com/pclick.php?p=721268544&a=98057&m=495" ["name"]=> string(73) "Clearance - Hatherley High Gloss 2 Drawer Bedside Chest in Walnut and Red" ["linkname"]=> string(73) "clearance---hatherley-high-gloss-2-drawer-bedside-chest-in-walnut-and-red" ["rrp"]=> string(4) "0.00" ["sell_price"]=> string(5) "27.19" ["discount"]=> string(5) "89.00" ["image_link"]=> string(56) "721268544.jpg" ["furniture_group"]=> string(0) "" ["category_name"]=> string(0) "" ["merchant_category"]=> string(0) "" ["fulldescription"]=> string(0) "" ["price"]=> string(5) "27.19" ["merchant"]=> string(13) "Furniture 123" } array(1) { ["product_id"]=> string(4) "6550" }

This is the htaccess file…

Options -Indexes
Options -MultiViews
Options +FollowSymLinks

# Prevent viewing of htaccess file
<Files ~ "^\\.ht">
order allow,deny
deny from all
satisfy all
</Files>

# Error Pages
ErrorDocument 404 /404-error.php

# Rewrite Rules
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([a-z]+)/([a-z\\-]+)$ /$1/$2.php [QSA,L]
  RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L]
</IfModule>

OK, but what happens when you visit the full URL (ie. with the product name included in the link)?

It continues to go to the 404 page.

In that case, I think your best bet would be to post the URL and the contents of your .htaccess over in this forum: http://www.sitepoint.com/forums/forumdisplay.php?97-Server-Configuration-Apache-amp-URL-Rewriting - they’ll probably be able to help you further. I hope that doesn’t sound like I’m just brushing you off, but I don’t know what else to suggest at this point.