I am having problems doing a redirect for some URLS, the ones from the old site that have a ? sign, won't redirect, every other URL will do. example: OLD: /laser-alignment-resources/presentations.cfm?pres=diaphragm
NEW: http://www.acquip.com/en/presentations/47-presentation-internal-laser-diaphragm-alignment
Won't work, I am sure I did something wrong but I am a n00b when it comes to .htaccess
all the URLs are in the same format, 14 in total:
OLD:/laser-alignment-resources/presentations.cfm?pres=gas New:http://www.acquip.com/en/presentations/48-presentation-gas-turbine-thermal-alignment
OLD: /laser-alignment-resources开发者_StackOverflow/presentations.cfm?pres=train NEW:http://www.acquip.com/en/presentations/49-presentation-complete-machine-train-alignment
any help will be appreciated.
Your question isn't clear on how you're trying to perform the redirects in your .htaccess
file, so for next time I'd recommend that you post some samples of the code that you've tried so that we can help you more easily.
Based on your Apache tag and the problem you're describing, I'm going to assume that you were using mod_alias
though, trying to do something like this:
Redirect 301 /laser-alignment-resources/presentations.cfm?pres=diaphragm http://www.acquip.com/en/presentations/47-presentation-internal-laser-diaphragm-alignment
This doesn't work though, as the Redirect
directive seems to only examine the path portion of the request, and not the query string.
If you have mod_rewrite
available, you can setup rewrite rules for the URLs that you need to redirect based on their query strings. This would look something like this:
RewriteEngine On
RewriteCond %{QUERY_STRING} =pres=diaphragm
RewriteRule ^laser-alignment-resources/presentations\.cfm$ http://www.acquip.com/en/presentations/47-presentation-internal-laser-diaphragm-alignment [R=301,L]
RewriteCond %{QUERY_STRING} =pres=gas
RewriteRule ^laser-alignment-resources/presentations\.cfm$ http://www.acquip.com/en/presentations/48-presentation-gas-turbine-thermal-alignment [R=301,L]
...and so on. You can keep your currently working Redirect
statements, as they should work fine side-by-side with these rules.
精彩评论