I recently restru开发者_如何学Goctured my site, moving away from querystring parameters to friendly urls. The url structure I used to use was mysite.com/?site=www.somesite.com/
. I am now using the site
parameter as part of the page's path, with my new url structure being mysite.com/site/www.somesite.com
I cannot figure out the proper rewrite rule to for my .htaccess
file to redirect the old url structure to the new
Put this in your .htaccess file:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^site=(.*)$
RewriteRule .* /site/%1 [L,R=301]
Edit: In reply to comment #3
Change RewriteRule
to:
RewriteRule .* /site/%1? [L,R=301]
精彩评论