SEO Class in Chicago, IL
Learn How To Optimize Your Website on July 26, 2013
High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!
Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Change The Name Of A Directory
#1
Posted 12 June 2008 - 06:51 PM
#2
Posted 12 June 2008 - 10:55 PM
Where in the <form> are you needing to change the name of a subdirectory? What is the form supposed to do exactly?
#3
Posted 13 June 2008 - 02:37 AM
Intention is that the clients sales team can, when in the field, sell Pr-Configured Accounts consisting of full CMS with new merchant on their own Sub Directory. Such as:
website.co.uk/301
becomes
website.co.uk/smithbrothers
website.co.uk/302
becomes
website.co.uk/brownandson
The numbers 301 302 etc then becomes the merchant reference for MYSQL entries as well as billing and technical support. This allows a field sales person to set up a demo account and the whole thing can be configured from Web Forms with all other merchant profile specifics set using a normal record update form.
I do not wish to allow Sales People to have any "Powerful" access such as Cpanel etc for a multitude of obvious reasons and have spent a great deal of time designing the whole CMS Structure to work on the reference numbers leaving only the Renaming of a Sub Directory to be done, but it is not within my skills to do so.
#5
Posted 13 June 2008 - 07:15 PM
They are a;l working as merchant accounts with full CMS.
All that is required is to rename 301 to merchantname
Looking at the PHP rename function that you pointed me to it seems that is what I need to learn to do. I will look into examples etc and see if I can drive it from a form to do what I need.
By the way, will it maintain permissions including that of child folders and files within the renamed directory.
#6
Posted 13 June 2008 - 09:20 PM
How about another option that should actually be easier with the number of subdirectories you're talking about. You could use php to set up a Symbollic Link with the symlink() command, or a hard link with a link() command. Or if you have access to the exec funciton via php you can even use it with the normal *nix symlink command. eg exec('ln -s source destination');
Note if you use this one the order is going to seem a bit backwards. The Source is where the files actually exist. The Destination is what new location you want to enable. So in your case the number would come first and the merchantname would come second.
Also note that you may need to use the full server path, not the the path from the web root. When in doubt use the full path.
Using this method would mean the old subdirectories would still exist. The new directories would simply create a connection to allow the server to show it's sitting at one location when in actually it's still using the original location.
#7
Posted 14 June 2008 - 01:26 PM
The main criteria for a succesful solution is that sales person can change folder name (URL wise) without FTP and without request back to me to do it for them. Hence my focus on doing it via a Web Form and not to have too powerful a set of tools at that.
website.co.uk/302
becomes
website.co.uk/merchantsname
I can produce next available Number (302 etc) number from a Recordset because the number remains that merchant reference..
I could also produce Merchant Name from a recordset because the Sales person would have to enter that in the Table holding ALL Merchants details.
So I could quite easily make an include that would contain $reference along with associated $merchantname.
This include could be pulled into the redirect page after updating the Merchants Table.
So I have $reference and $merchantname to, pull into my symlink() page.
What exactly happens now ? Where is this stored ? Can I manually edit ?
Also will all URLs of files contained within the 302 folder be presented as:
merchantname/file.php
merchantname/products/file.php
instead of:
302/file.php
302/products/file.php
302/products/file.php
Further what about the possibility of SE Duplicate problems.
I know that's a lot to ask Randy, but I hope you have time.
#8
Posted 15 June 2008 - 10:05 AM
Definitely doable. Shouldn't be too hard. As soon as I get a few spare moments I'll try to whip up a little mockup for you to work from.
#9
Posted 18 June 2008 - 01:50 PM
If you want to test it, create a test directory on the server in question. Then upload the following php file to the level just above this test directory and run it in your browser. (I'm naming the test directory testdir since it's hard coded.)
$actual_directory = "testdir";
$link_directory = "link_directory";
$symlink_directory = "symlink_directory";
$exec_directory = "exec_directory";
link($actual_directory, $link_directory);
symlink($actual_directory, $symlink_directory);
exec("ln -s " . $actual_directory . " " $exec_directory);
?>
If you have your php error reporting set to sensitive you'll see warning errors (Permission Denied) for the first two if they fail. For me the exec fails silently. Check in your FTP or control panel to see if any of the new directories have been created. I'm going to guess they probably haven't. After checking into it more closely, I doubt a host would open up those if they have them closed already since there are some pretty major security implications. I know I wouldn't.
So let me know how that goes and we can think on other ways to accomplish the same sort of thing. You could of course use a bit of mod_rewrite to allow people to use those named directories without them actually being created. And write a little php application to add lines to an .htaccess file to do it. This would probably be the easiest.
If you really wanted to make the symbolic linked directories real you'll probably have to resort to a cron job that fires every X minutes and reads from a file that php has written the details to. This should work in theory however since the server shouldn't run into the same permission problems Apache has.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users









