Rewrite a dynamic page to static page

Discussion in 'PHP' started by allpointer, Jul 3, 2008.

  1. #1
    I am trying to rewrite my site's urls from
    http://www.mysite.com/folder/product-list.php?&dff_catnum=4297
    Code (markup):
    to
    http://www.mysite.com/folder/products_category-4297
    Code (markup):
    I just can't get it to work. Pls help.
     
    allpointer, Jul 3, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    save following in .htaccess


    Let me know if it works.

    regards
     
    Vooler, Jul 3, 2008 IP
  3. allpointer

    allpointer Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the response. That didn't work. I've tried it in .htaccess in the root and also in the folder within the root, but with no luck. I also tried changing it to
    RewriteEngine on
    RewriteRule ^/folder/category-([0-9]*)$ product-list.php?&dff_catnum=$2 [L]
    Code (markup):
    but that didn't work either.
     
    allpointer, Jul 3, 2008 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4
    Oh sorry, my typo, followng must work, save as .htaccess and upload in the sub-folder called 'folder'

    and browse like: "http://www.mysite.com/folder/products_category-4297"

    Let me know if this one does nto work too. I think it will work, although I did not test it.

    regards
     
    Vooler, Jul 3, 2008 IP
  5. allpointer

    allpointer Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I am not sure what could be missing. That didn't work either. Is it really necessary to clear cookies?
    Cheers.
     
    allpointer, Jul 3, 2008 IP
  6. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #6
    Clear entire browse cache, and quite possible that your ISP be sending old pages, check your url through some proxy browsing site. I just added same feature in the short url creation script I provided a while ago, and it worked on that perfectly.

    regards
     
    Vooler, Jul 3, 2008 IP
  7. jmf000

    jmf000 Peon

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    1) you have to have in directory /folder context of your httpd.conf (something like this)
    
    <Directory ~ "/folder$">
    AllowOverride FileInfo
    </Directory>
    
    Code (markup):
    After changind httpd.conf restart the server
    2) .htaccess must be placed in the folder and must have the folowing lines
    
    RewriteEngine On
    RewriteRule ^products_category-([0-9]+)$    product-list.php?&dff_catnum=$1 [L]
    
    Code (markup):
     
    jmf000, Jul 3, 2008 IP
  8. allpointer

    allpointer Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    My site is on a shared server, I don't have access to httpd.conf. The database for the content on my site resides on a different host. Probably that other host has to set this up for my urls to display properly. I am not sure why none of these solutions worked, but I think they should have. I appreciate all the help.
     
    allpointer, Jul 4, 2008 IP