
August 2nd, 2004, 06:31 PM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Problem with creating 301 redirect
I am using PHP on an IIS 6.0 server and am trying to give users a 301 "Moved Permanently" http header for many thousands of files that were mistakenly put in the wrong place. Instead of 301, I get a 302 status ("Moved Temporarily") from my server.
The PHP code I am using to create what should be a 301 redirect is extremely simple and repeated ad nauseum on the web. I have run the code by some PHP forums with various people saying I am doing it correctly and there is no solution forthcoming. I dare say I may have discovered a bug in PHP since this exact same bug was in an earlier version, although it was supposedly fixed. Maybe the bug was only fixed for some web servers like Apache but somehow doesn't work in IIS 6.0 - I don't know.
So my question is, is there some other way I can get my IIS server to return a 301 code? If I was using Apache, I gather, I would simply make a bunch of changes to my .htaccess file, redirecting on a file-by-file or folder-by-folder basis. The problem is that it's not just a few files but many many thousands of files in hundreds of different directories.
For some of the directories, all there are in there are files that need redirection. So in those directories, I can "fool" my IIS into believing that my .php files really require Perl to operate (by selecting folder properties from within IIS and configuring my execute permissions) and then I simply replace my PHP scripts with Perl scripts which do, thankfully, produce the 301 redirect status I need.
But this little trick cannot be used when the old .php files are in directories that also contain legitimate .php files since I would have to convert even my legitimate, non-redirected .php scripts into Perl scripts.
So my question is, first does anyone know how to solve this PHP-IIS problem? If not, can you think of a work-around like the one I'm trying with Perl? Is there some IIS equivalent to .htaccess that allows a file-by-file redirection?
Thanks for your help.
|