Forum Moderators: phranque
I need help to permanent redirect some dynamic URL's to static html.
Example:
http://www.example.com/pages/index.php?page=name-of-article
to
http://www.example.com/pages/name-of-article.html
I tried this:
RewriteRule ^pages/index.php?page=name-of-article$ http://www.example.com/pages/name-of-article.html? [R=301,L]
but it didn't work. What am i doing wrong?
Can anyone help me? Thanks in advance.
Jim
I tried to put \:
RewriteRule ^pages/index\.php?page=name-of-article$ http://www.example.com/pages/name-of-article.html? [R=301,L]
i need to redirect specific pages only, i think that example is if i want redirect all dynamic URLs to friendly ones, right?
i mean, i need to redirect 301 http://example.com/pages/index.php?page=name-of-article to http://example.com/2.html for example, i don't need friendly URL
RewriteCond %{QUERY_STRING} [&]?page=name-of-article[&]?
RewriteRule ^pages/index\.php$ http://www.example.com/pages/name-of-article.html? [R=301,L]
In other words, if any character precedes or follows the name/value string you're matching, it must be an ampersand.
If you only ever have that one name/value pair, this won't be needed and you can simply start- and end-anchor the pattern as usual with "^" and "$"
Jim