.htaccess - How do I redirect a URL with a parameter to a clean URL in htaccess? -
i attempting 301 redirect several urls parameters @ end clean urls.
for example trying redirect: http://example.com/news/news.php?id=1234 http://example.com/posts/vanity-url.php
here code:
rewritecond %{query_string} id=1234 rewriterule ^news/news\.php$ /posts/vanity-url.php [l,r=301]
i feel i'm close code redirects me to: http://example.com/posts/vanity-url.php?id=1234 , i'm not sure why happening.
i appreciate help. thank you!
add question sign after remove query string
rewriterule ^news/news\.php$ /posts/vanity-url.php? [l,r=301]
Comments
Post a Comment