Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

apache - Redirect URL using Query String parameter in URL -


i have bunch of urls old site updated ee2. these urls this:
http://www.example.com/old/path.asp?dir=folder_name

these urls need redirect to:
http://www.example.com/new_path/folders/folder_name

not folder_name strings match folder_name url segments, these need static redirects.

i tried following rule particular folder called "example_one" maps page on new site called "example1":

redirect 301 /old/path.asp?dir=example_one              http://www.example.com/new_path/folders/example1 

but doesn't work. instead of redirecting 404 error telling me http://www.example.com/old/path.asp?dir=example_one cannot found.

edit:
there's secondary problem here may or may not related: have catch-all rule looks this:
redirect 301 /old/path.asp http://www.example.com/new_path

using rule, requests first 1 above redirected to:
http://www.example.com/new_path?dir=folder_namewhich triggers 404 error.

just had scour google bit more find proper syntax mod_rewrite.

using example above:

rewritecond %{query_string} ^dir=example_one$ rewriterule ^/old/path\.asp$ /new_path/folders/example1? [r=301,l]  

this fixes both of problems above -- why ee 404ing 1 parameter in query string, problem still unsolved, works workaround problem.

you can redirect urls specific page parameter may have different value each time. 1 example of google utm campaign tracking (in situations tracking query string triggers 404):

link: http://www.example.com/?utm_source=xxx&..... (triggers 404)
should redirect to: http://www.example.com

rewritecond %{query_string} ^utm_source= rewriterule ^$ http://www.example.com? [r=301,l]  

note: redirect requests homepage, defined ^$. if want redirect utm requests different page, you'll need change first part of rewriterule.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -