dazedandconfused1405241578 0 Report post Posted September 2, 2009 Hey guys-New to the forum and have a question you'll probably think is really easy with htaccess.I've recently completed 1 phase of a redesign of a website and have changed files in a directory from html to php. I know I can use the 302 redirect for making the permanennt change, but I was trying to avoid targeting each file and would rather target the complete directory. Here's an example of what I need to do:http://myDomain.com/main/*anyfile.html redirects to http://myDomain.com/main/*anyfile.phpAny help would be greatly appreciated!Thanks! Share this post Link to post Share on other sites
wutske 0 Report post Posted September 2, 2009 (edited) Imho that's not a good way, either link to the correct files or don't link to them at all. Edited September 2, 2009 by wutske (see edit history) Share this post Link to post Share on other sites
yordan 10 Report post Posted September 2, 2009 If you are on a Linux system, you can do a little bit scripting in order to do the job.Once you have the names of the files you renamed (for instance names.html should become names.php)You can obtain the list of the concerned files with something like "grep names.php *"And then, for each of the concerned files, do cat $1 |sed 's /names.html/names.php/g'|sed 's/file2.html/file2.php' >$1.tmp; cp $1.tmp $1Of course, backup your source folder, and first test it without the last "cp" instruction... Share this post Link to post Share on other sites