Sherwin Flight
Sherwin Flight

Reputation: 2363

htaccess - rule explanation

I was wondering if anyone could explain what this rule is saying:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteRule (.*)\.html$ news.php?name=$1
</IfModule>

Upvotes: 0

Views: 54

Answers (2)

Michael Rice
Michael Rice

Reputation: 1183

Match anything that ends with .html in the URL string. Pass the file part before .html and after the domain name to the news.php script as $_GET['name'].

Upvotes: 1

jimw
jimw

Reputation: 2598

It translates URLs like:

/foo.html

into URLs like:

/news.php?name=foo

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Upvotes: 1

Related Questions