I was thinking of switching one of my sites from html to php, but I have thousands of backlinks for the .html files.... I have heard you can redirect to the new links.... what is the best way to do that? I found this: Will that work? or do I need to do something different... Basically Im going to make a new .php page for every page that is .html and I want the users to be redirected to the new pages so I dont lose any of my backlinks etc... Ive been trying to do things and I think keeping it html is going to make me need to use many methods/lines of code instead of using few php scripts.. pleeeease help!! I want to get this done today!
I don't think you can use 'Redirect' in the .htaccess to do this, you can try "Redirect *.html *.php" but that probably won't work. You need RewriteRule & RewriteCond
RewriteEngine on RewriteRule ^(.*)\.html $1.php [R=301,NC] Code (markup): Will do a permanent redirect from page.html to page.php Depending on how you plan on switching over, you may want to use a check and only redirect if no html file exists, that way once the file is renamed it will automatically go to the new .php but not before, you would place this above the RewriteRule line. RewriteCond %{REQUEST_FILENAME} !-f Code (markup):