Hello guys,
Maybe someone can help me...
I have thousands of files to edit in my server and this will consume me lots of hours editing all files manually one by one.
So, I had an idea but I don't know if is possible to make... to create a tools to edit all my files automatically.
This is the tree view of directory/files of my website:
Code:
directory3
directory3/file.php
...
directory4
directory4/file.php
...
links
link/sitename.php
...
This is the content of /directory3/ and /directory4/ files:
Code:
<?php
echo '<a rel="nofollow" href="http://www.domain.com/link/sitenameA.php" target="_blank"><span>Site Name</span></a>
<a rel="nofollow" href="http://www.domain.com/link/sitenameB.php" target="_blank"><span>Site Name</span></a>
<a rel="nofollow" href="http://www.domain.com/link/sitenameC.php" target="_blank"><span>Site Name</span></a>';
?>
This is the content of all files inside the links directory:
Example:
http://www.domain.com/link/sitenameA.php
Code:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://affdomain.com/?id=code" );
?>
What I need to change is the URL inside of the href="" of all /directory3/ and /directory4/ files.
From:
Code:
<a rel="nofollow" href="http://www.domain.com/link/sitenameA.php" target="_blank"><span>Site Name</span></a>
To:
Code:
<a rel="nofollow" href="http://affdomain.com/?id=code" target="_blank"><span>Site Name</span></a>
....................
So, is possible to create some kind of script that grabs the Location of the link/sitenameA.php file:
Code:
http://affdomain.com/?id=code
And replace with the URL inside of href="" of all /directory3/ and /directory4/ files?
Code:
http://www.domain.com/link/sitenameA.php
Sorry if the post is a little confuse but is a little difficult to explain.
But if you didn't understood, please let me know and I will try to explain better.
Waiting for your replies, thanks! :-)