This agent file provides instructions for migrating pages from the /script/ directory to their own dedicated directories with cleaner URLs.
The migration follows these steps:
index.phpFor a page currently at script/PAGENAME.php, create:
PAGENAME/
└── index.php
The new index.php should contain:
<?php
$title='Page Title';
$description='Page description for SEO';
$folder='PAGENAME';
include('../script/session.php');
?>
Replace the content of script/PAGENAME.php with:
<?php
header("Location: /PAGENAME/", true, 301);
exit();
?>
Search for and replace all references to the old URL pattern:
Old patterns to find:
<?php echo $_SESSION['RelativePath']?>/../script/PAGENAME.php../script/PAGENAME.phphref="<?php echo $_SESSION['RelativePath']?>/../script/PAGENAME.php"href="PAGENAME.php"href="/script/PAGENAME.php"Replace with:
/PAGENAME/href="/PAGENAME/"Look for these patterns in the codebase:
<a href="<?php echo $_SESSION['RelativePath']?>/../script/PAGENAME.php"><a href="../script/PAGENAME.php"><a href="PAGENAME.php"><a href="/script/PAGENAME.php">Files Changed:
defines/index.php (new location)script/defines.php (now redirects)include/command-line-options.phpinclude/formats.phpChanges Made:
<?php echo $_SESSION['RelativePath']?>/../script/defines.php/defines/When asked to migrate a URL, follow these steps:
Identify the page: Ask which script file to migrate (e.g., script/PAGENAME.php)
$title variable$description variableSearch for references: Use the search tool to find all files referencing the old URL pattern script/PAGENAME.php
PAGENAME/PAGENAME/index.php with proper metadata and folder variable$folder variable matches directory nameConvert old file: Replace content with 301 redirect
/PAGENAME/multi_replace_string_in_file when updating more than one file — batch all replacements into a single call rather than calling replace_string_in_file repeatedlyVerify: Check if there are any remaining references to old URL
git add PAGENAME/index.php to stage the new file<a href="<?php echo $_SESSION['RelativePath']?>/../script/PAGENAME.php">
<a href="/PAGENAME/">
Based on the defines migration, commonly updated files include:
include/*.php - All include filesscript/After migration, verify:
/PAGENAME/) not relative paths/PAGENAME/ not /PAGENAME)$folder variable should match the directory name