wordpress - 301 redirect with ? and & .asp -
i know there few articles out there i'm novice when comes redirects in .htaccess files excuse ignorance! have tried few things cannot work.
i have old url http://domain.com/ourlocations.asp?cat=41&id=41 trying redirect in .htaccess http://domain.com/locations . first/old url included in printwork through qr code i'm kinda stuck. have tried using simple redirect 301 no luck. have seen posts using rewriterule have existing code in .htaccess (wordpress) , afraid alter in case brings down site.
# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress has got ideas? time.
this rewriterule should redirect http://domain.com/ourlocations.asp?cat=41&id=41 http://domain.com/locations.
- the rewritecond directives check query string arguments.
- the first part of rewriterule matches if you're in
/ourlocations.asp - the trailing
?in substitution part of rewriterule strips query parameters (remove if want parameters passed-on) [r=301]tells apache 301 redirect
-
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{query_string} cat=41 rewritecond %{query_string} id=41 rewriterule ^ourlocations\.asp http://domain.com/locations? [r=301] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule>
Comments
Post a Comment