SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    India
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URL REwriting removing / sepratores and using - instead

    Hello

    First of all thank You for reading the post.
    I have a website where the present URLs for the pages are written like -
    http://www.example.com/india/delhi/s...cket-bats.html

    My client wants to have it like -www.example.com/india-delhi-sports-cricket-bats.html
    Is it possible? The last value - "cricket-bats" are in fact a single value used to check with the data in the tables. So if we have separators with hiphens will that be a problem? How can i accomplish this?

    Thank you Once again
    Regards

    Sathish

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Yes, it will be a problem. That is exactly why I won't use hyphens in a title (I use _'s to replace spaces; you may wish to do the same for your /'s).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi
    To have more control of the accessed page in database, I add the page ID in URL (which is unique) instead of ".html".
    Like this: domain.net/category/page-title-abcd_12 .
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    MarPlo,

    That would allow it to work by capturing all digits at the end of the {REQUEST_URI} string (following ^category/.*([0-9]+)$) and using that as the value for id in the query string.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •