I will redirect my old domain to new one. I must redirect file by file because file paths will be different. Is there any better way to redirect a big number of pages than this : redirect 301 /old.php http://newdomain.com/directory/new.php With this choice I will must have lets say 3 hundred lines of that code Is there any better way??
Most defenitely. Mod rewrites use regular expressions. Those are extremely powerfull and notoriously hard to understand. If I understand you correctly you are trying to redirect everything to newdomain/directory? so if you want to redirect olddomain/old.php?=somestring to newdomain/directory/new.php?=somestring you can do something like this: RewriteRule ^old.php(.*)$ http://www.newdomain.com/directory/new.php$1 [R=301,L] (all in one line) This keeps the characters after old.php. RewriteRule ^(.*)$ http://www.newdomain.com/directory/$1 [R=301,L] Redirects all requests to any file to the new domain and new directory. I haven't tested any of those. As I said its notoriously hard to understand ang get it right. Try it out. Basically ^$ marks beginning and end of a search string, (.*)x(.*) remembers anything like string1xstring2 which can be recalled by $1-$2 to give string1-string2. This is just to give you some idea about the whole thing. You should read up on the process. Defenitely do NOT put 300 lines in your .htaccess. They all have to be processed by Apache for every single hit (not page view, hit !). This can mean an enormous load to Apache.