htaccess - rule explanation

Go To StackoverFlow.com

0

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>
2012-04-05 02:03
by Sherwin Flight


1

It translates URLs like:

/foo.html

into URLs like:

/news.php?name=foo

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

2012-04-05 02:09
by jimw
Thank you for the explanation : - Sherwin Flight 2012-04-05 05:52


1

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'].

2012-04-05 02:10
by Michael Rice
Thank you for the quick answer. I upvoted it, but picked the other answer as the accepted answer as it explained it a little easier - Sherwin Flight 2012-04-05 05:53
Ads