How to move one directory to another directory?

Use rename(). Note that if this runs on a web server, the web server user must have access to write to the target directory.

rename("oldpath", "newpath");

// in your case, assuming the script calling rename() 
// resides in the directory above 'myappdemo.com'
rename("myappdemo.com/VueGuides/services/iclean", "myappdemo.com/VueGuides/services/pics/iclean");

// Or use full absolute paths
rename("/path/myappdemo.com/VueGuides/services/iclean", "/path/myappdemo.com/VueGuides/services/pics/iclean");

If you are worried about SEO i recommend you using redirects 301 in your .htaccess.

That must be something like that:

RewriteRule ^/VueGuides/services/iclean  http://myappdemo.com/VueGuides/services/pics  [NS,R=301,L]

There's a specific PHP function for it

http://php.net/manual/en/function.rename.php

Tags:

Php

File