My client is determined to have a page at /nfm&t
so I made a directory named nfm&t
with an index.html (to test) and that URL is still throwing a 404. So apparently it's not that easy.
Any ideas? Or is there a way to just redirect nfm&t
to nfmt
, so that the URL at least resolves?
This is a Wi开发者_运维问答ndows server, by the way, which throws a wrench into how I'm used to doing redirects.
Turning on AllowRestrictedChars and enabling VersionCompatibility should do it.
Why would a Windows Server throw a wrench into how you do redirects? If you are using IIS 7, you can use URL Rewrite Module. It is built into IIS. If you are using IIS 6, there is ISAPI Rewrite, which is an external module. Both use the same syntax as mod_rewrite for Apache.
Do you have a /nfm directory? If you don't, try making one. Either way, put in a Default.aspx file and have it spit back at you the exact path it's trying to access. Chances are, when you have this here, it will go to example.com/nfm/Default.aspx
and let you run something from there.
If you do get to that directory, then try redirection to example.com/nfm%26t
and see if it works. If this still doesn't help it, then you're SOL
I tried this on my Snow Leopard ( OSX 10.6.2 ) workstation with Apache and it works. That is from Firefox 3.6. Looks like a Windows thing you are struggling with. Honestly I didn't think that would work without encoding but you never know until you try.
alt text http://www.vertigrated.com/images/so_screenshot.png
Or is there a way to just redirect nfm&t to nfmt, so that the URL at least resolves?
Sure. Make a general url handler and/or an error handler. When it encounters a url, if that url is equal to /nfm&t
, then under the hood rewrite the context to whatever page you actually really want to return. Is this a good idea? Probably not. But it will work. Keith's answer suggests two ways to grab the url and do stuff, though you could also do this via a global asax file (being careful to execute an aspx page when you hit an error so it actually gets hit) if you're using .Net.
精彩评论