Gallery now working

If you were a user of the Halo Photography Gallery then uploading of fies and screenshots is now working, I kind of forgot to check that it was still possible to upload after upgrading servers from the US (Dreamhost) to the UK (EukHost), Oppsy.

I’ve made a few adjustments just to make things run a bit smoother, one of the things I did was to change the URL location of the old Photography gallery from halo.snaver.net/Photography/ to halo.snaver.net/photography/. Now this doesn’t seem like a big change, but simply de-capitalizing the p in photography messes everything up causing 404 errors.

To solve this I created two directories, one named ‘Photography’ and the other ‘photography’, these can exist on a linux system as it respects capitalisation. In the script I had the following code to redirect all old requests to the new location, all without the use of odd complex .htacces code, enjoy!

Remember you have to have some code in your .htacess file to direct all requests to index.php for this to work

<?php
	function processURI ($uri) {
		$lv = false;
		if (substr_count($uri, "/") &lt; 1) {
			return false;
		}
		else
		{
			$c = split("/", $uri);
			unset($c[0]);

			$command['root']=$c[1];

			foreach ($c AS $k =&gt; $v) {
				if ($lv) {
					$command[$lv]=$v;
					$lv = false;
				}
				else
				{
					$command[$v]="";
					$lv = $v;
				}
			}
			return $command;
		}
	}

	$command = processURI ($_SERVER['REQUEST_URI']);
	//print_r($command);
	//echo "http://halo.snaver.net/photography/".$command[Photography]."";

	header("HTTP/1.1 301 Moved Permanently");
	header("Location: http://halo.snaver.net/photography/".$command[Photography]."");

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.