1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to rewrite this type of urls and create an entry page

Discussion in 'Site & Server Administration' started by AdultFoundry, Nov 25, 2015.

  1. #1
    I have a php script, which creates urls like this:

    domain.com/model/sunny-leone-133.html
    domain.com/model/stoya-2.html
    domain.com/model/kagney-linn-karter-14.html

    I want all of them to appear as something like this:

    domain.com/model/sunny-leone

    The number on the end are needed for database lookups, so I guess they would be there, but now visible to the visitors, if this can be done this way.

    I would then want to crate an entry page, something like this:

    domain.com/go

    and this could be entered with something like this:
    SEMrush
    domain.com/go?m=sunny-leone
    domain.com/go?m=stoya
    domain.com/go?m=kagney-linn-karter

    and this would be redirecting to the specific model pages. I can work on that part, I am just not sure how to do the first, rewriting part, and if this can work this way. All model names would be unique.

    Thanks.
     
    AdultFoundry, Nov 25, 2015 IP
    SEMrush
  2. werewe12

    werewe12 Well-Known Member

    Messages:
    1,034
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Hi. Search Apache mod_rewrite examples in Google.
     
    werewe12, Nov 27, 2015 IP
  3. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #3
    You posted this on another forum and you have changed your requirements a bit. You do not need a numeric ID on the URL. The identifying portion of the URL is called a "slug" and as long as you have a field in your database, you can use the slug to identify the post.

    In your database where you have the performer information, just add another field called "slug" and inside that field you put your identifying information and query based on that, not the ID number. So your slugs are "sunny-leone", "kagney-linn-karter", and so forth and when you retrieve data, you query on the slug (make sure to put a unique constraint on it and index it for faster performance).

    You could do it like this:

    yoursite.tld/sunny-leone
    OR
    yoursite.tld/model/sunny-leone

    And you would write your htaccess rewrite code to reflect which version you want to use and redirect the request to the appropriate file which would then query the database based on the slug (sunny-leone).

    There is no need to have a .html extension on your URLs and if you are using mod_rewrite, it is stupid to do that anyway.
     
    billzo, Nov 28, 2015 IP