Tuesday, August 24

Curse you MOD_REWRITE

I am not a regular expressions kind of guy. I'm also not a mod_rewrite kind of guy.

But it's exactly those things which can solve my current webish problems.

I need to make
http://www.clanlord.net/journal

turn into

http://journal.clanlord.net

and of course, any URLs like

http://www.clanlord.net/journal/something

should become

http://journal.clanlord.net/something
This is precisely the sort of mojo that mod_rewrite is meant to do, but dagnabbit, I can't get it to work yet. I know mod_rewrite is working, because I can do very simple rewrites, like changing foo.html into pointing to bar.html, but that's the extent of my powers.

If anyone has any tips, I'd love to hear them. Keep in mind that I'm using .htaccess files to invoke mod_rewrite, which apparantly is important in some way, but it shouldn't be a show stopper.



Older entries

'; } else { if(stristr($filename,"archive")) { $dir=$_SERVER['DOCUMENT_ROOT']; $template='_01_archive.html'; $tail=strlen($template); $thisArchive=$filename; //$files=scandir($dir); $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } sort($files); $earlyarch=""; $laterarch=""; $prevarch=""; $next=0; foreach($files as $file) { if (substr($file,-$tail)==$template) { if ($next==1) { $laterarch=$file; $earlyarch=$prevarch; $next=0; } if ($file==$thisArchive) { $next=1; } else { $prevarch=$file; $earlyarch=$prevarch; } } } $link=''; $divider=''; if(file_exists($earlyarch)) { $link='< Earlier Archive'; $divider=" | "; } if(file_exists($laterarch)) { $link=$link.$divider.'Later Archive >'; } $link=$link.'

'; } } echo($link); ?>