How to replace escape codes in url and redirect it using htaccess?
I need to redirect multiple urls from this format:
http://site.com/gallery.php%3Fpage%3D12
开发者_JS百科(the 12 at the end is the page number, i have many links like this with different numbers at the end)
to this:
http://site.com/gallery.php?page=12
how to i write a rule in htaccess that will replace those chars in all the urls and redirect them to the correct urls?
By default URLs in mod_rewrte are decoded(unescaped) so there is no need to escape(encode) them!
As mentioned by "Death", there is no need to replace the chars, this simple rule did the trick:
RewriteRule ^gallery\.php\?page\=(.*) http://site.com/gallery.php?page=$1 [R=301,L]
精彩评论