Jump to content

Recommended Posts

Say below is my normal html href link. How would you turn this into a pretty URL using .htaccess?  Also if I understand it correctly, this link will also have to be changed to match the pretty url.  What would the new link look like? 

<a href="shop.php?type=45&name=belts">Belts</a>

What would the new link look like?

 

Designing the URLs is your job. “Pretty URLs” are just an abstract concept for URLs that are optimized for readability. How exactly your URLs should look like is something only you know. A good guideline is Cool URIs don't change from Tim Berners-Lee himself.

Edited by Jacques1

Designing the URLs is your job. “Pretty URLs” are just an abstract concept for URLs that are optimized for readability. How exactly your URLs should look like is something only you know. A good guideline is Cool URIs don't change from Tim Berners-Lee himself.

 

I've been pulling my hair trying to figure this out and so far unsuccessful.  It would be very helpful if someone knowledgeable about this can help me out.  Every professional site I see out there has pretty urls, as oppose to what I have above.  Even phpfreaks site has pretty urls.  How would I go on about doing that based on the link I provided above?  So far all I got is this. How would I change the above link to match this?

RewriteRule ^([a-z]+)\/([0-9]+)\/?$ shop.php?type=$1&name=$2 [NC]

This makes no sense. You're now assuming an alphabetical type followed by a numerical name, but your link above has the exact opposite (a numerical type and an alphabetical name).

 

Again: You have it backwards. You tell us your the URLs should look like. And then we can tell you how to implement them. Guessing from your example, it seems you want this:

/belts/45

So first the category, then the numerical type. Correct?

This makes no sense. You're now assuming an alphabetical type followed by a numerical name, but your link above has the exact opposite (a numerical type and an alphabetical name).

 

Again: You have it backwards. You tell us your the URLs should look like. And then we can tell you how to implement them. Guessing from your example, it seems you want this:

/belts/45

So first the category, then the numerical type. Correct?

 

Well yes like that, although belts can come after the 45.  Like this.

shop/45/belts
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.