SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    add .html at the end of url

    hi all

    Code:
    RewriteRule ^-(.+?)-(.+?)-(.+?) index.php?s=$1&d=$2&i=$3
    The above code works fine and gives me result as

    Code:
    index-1-2-3
    now i want to add "productname.html" at end of it like

    Code:
    index-1-2-3-productname.html
    If i use the below code then my result query doesnt works
    Code:
    ^-(.+?)-(.+?)-(.+?)\.html$
    vineet

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

    Code:
    RewriteRule ^-(.+?)-(.+?)-(.+?) index.php?s=$1&d=$2&i=$3
    ... will NOT match (and then redirect) index-1-2-3 as you stated. The leading - will prevent that.

    Rather than waffle through your coding attempts (and whine at you about why your code is inadvisable), let me refer you to the mod_rewrite tutorial linked in my signature as, IMHO, you need to learn some proper regular expression syntax in order to achieve your goals.

    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 Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thanks dk

    its a nice article to read and learn

    vineet

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

    If you have questions, you know where to find me. Now, after you've learned some regex, please show your code again and I'll be happy to help you get where you want.

    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


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
  •