RewriteRule problems

Discussion in 'Apache' started by carrucola, Mar 10, 2009.

  1. #1
    Hi all,
    I'm having troubles with a Rewriterule

    I have 2 pages for the news:

    www.mysite.com/news.php (it contains the news list)
    www.mysite.com/news_detail.php?article=test (detail page)

    I want trasform the urls like this:

    www.mysite.com/news/
    www.mysite.com/news/article/test.html


    In my htacces file I've created this rules:

    RewriteRule ^news news.php
    RewriteRule ^news/article/([^/]+).html news_detail.php?article=$1 [L]

    But it does't work.

    If I write each rule separately, it works.. what I have to do?

    Thanks
     
    carrucola, Mar 10, 2009 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    Try:
    RewriteEngine On
    RewriteRule ^/?news$ news.php
    RewriteRule ^/?news/article/([^a-zA-Z-_0-9]+).html$ news_detail.php?article=$1 [L]
     
    buldozerceto, Mar 10, 2009 IP