rewrite url /blog/article.php?id=hello to /blog/hello.html

949 views Asked by At

Im having some troubles with the redirection rules on my .htaccess file. I would like to create a rule to redirect my blog content to a friendly url. The current url structure is:

/blog/article.php?id=hello

and I would like it to change to:

/blog/hello.html

This are my rules so far, and I dont seem to be able to find the error:

RewriteEngine On
Options -MultiViews
RewriteRule ^blog/([a-z,A-Z,0-9]+)$.html blog/article.php?id=$1 [L]

Any help would be appreciated.

1

There are 1 answers

1
hjpotter92 On

Because of your placement of $ in the pattern, the rewrite module is unable to match your request to the expression.

It should be:

Options -MultiViews
RewriteEngine On
RewriteRule ^blog/([\da-z]+)\.html$ blog/article.php?id=$1 [L,NC]