What's wrong with my URL Rewrite?

Discussion in 'Apache' started by luizeba, Dec 2, 2009.

  1. #1
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteMatch 301 ^view/(.*)/(.*)/.htm$ view/$1/$2\.html [L]



    OR


    Options +Indexes
    Options +FollowSymLinks
    RewriteEngine on
    RedirectMatch 301 (.*).htm$ $1.html




    It's for my site: http://luizjogos.com/



    I want (for example)

    http://luizjogos.com/view/759/Defenda-o-Castelo.htm

    to go to

    http://luizjogos.com/view/759/Defenda-o-Castelo.html



    FIRST CODE: My site has a 'Internal Server Error'

    SECOND CODE: http://luizjogos.com/view/783/Rally-de-Portugal.htm to http://luizjogos.com/view/783/Rally-de-Portugal.html?task=view&id=783&name=Rally-de-Portugal



    I will love you forever if you can help
    I already read all the threads here in DP...but I can't figure what to do...

    Thanks guys!
     
    Last edited: Dec 2, 2009
    luizeba, Dec 2, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    try changing

    $2\.html

    to

    $2.html
     
    Bohra, Dec 2, 2009 IP
  3. luizeba

    luizeba Active Member

    Messages:
    265
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Hello mate

    So the code is:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteMatch 301 ^view/(.*)/(.*)/.htm$ view/$1/$2.html [L]

    If yes, I tried it now, and it's giving 'Internal Server Error', too...
     
    luizeba, Dec 3, 2009 IP
  4. luizeba

    luizeba Active Member

    Messages:
    265
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Really no one?? >.<
     
    luizeba, Dec 4, 2009 IP
  5. Kim_Miller

    Kim_Miller Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Try this code in your htacess file
    the visitor will see *.html in the address bar of their browser.

    Server will return the *.htm file

    
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^view/(.*)/(.*)\.html$ view/$1/$2.htm [L]
    
    Code (markup):
    We are doing a URL Rewrite, instead of a 301 redirect here.

    I hope that helps..
     
    Kim_Miller, Dec 5, 2009 IP
  6. luizeba

    luizeba Active Member

    Messages:
    265
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #6
    I put this code on my .htaccess
    What can I do to test, to see if it's working? =)
     
    luizeba, Dec 7, 2009 IP
  7. luizeba

    luizeba Active Member

    Messages:
    265
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #7
    No one know what I need do to test if it's working?
    Please, just that I need to finish it...
     
    luizeba, Dec 14, 2009 IP
  8. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #8
    u have to put it in the .htacess file in the directory u want it to be in
     
    Bohra, Dec 14, 2009 IP