Paypal donation of $20 to your favourite charity for the answer that works best! I have a problem where I have changed from a script that generated static html pages to one that produces php pages. I want to redirect all the old html pages (around 2500) to the new php pages BUT the filenames are not the same. Is there a way to redirect all the .html pages to www. domain.com or better still, to somehow redirect to the corresponding filename although it's not the same? I should mention that the pages (php and HTML) are all in the root folder. I don't know if that makes a difference or not. I hope I have included enough details. Thanks, Jez.
hi, you can use this RewriteEngine On RewriteBase / RewriteRule ^([^/]*)\.html$ /index.php?oldpage=$1 [L] in a .htaccess file in your root folder in your index.php you can recall the html page entered with: $_GET['oldpage'] for example (index.php) <? print $_GET['oldpage']; ?> if i enter yoursite.com/cow.html it will show cow in the index page
Hi pig2cat, Thanks for your help. I just tried the .htaccess code and it works. It's a very interesting solution. How will the search engines see it? Will they see it as a 301 redirect or as cloaking? Can it be changed so that the old URL does not show and it just redirects to the index page? Thanks. Jez.
I believe the search engine's will just see it as cloaked. this is serverside so it's unlikely that the SE's will notice..(i'm not an expert on this so i don't really know tho..) To 301 it. you need to change the [L] to [R,L]
Hi pig2cat, When I change [L] to [R,L] I get domain/index.php?oldpage=index. When I just use [L] I get a clean domain/ URL. Is there a way to have the 301 redirect plus the clean URL? Again, thanks for your help! Jez.
I had a play about and this is what I used in the end/ currently: RewriteEngine On rewriteRule ^([^/]*)\.html$ http://www.domain.com/ [R,L] Does that look OK to everyone? It just 301 redirects all old html pages to the domain (I hope that's what it's doing - it appears to work). Can anyone verify that this will do what I want? Conserve the rankings and PR of the old pages but not get me penalised by google. Thanks, Jez.
This just redirects them yes, the solution i gave, sent the name of the origional html page to the index page so you could do php things with it. the way you use it now just redirects everything to the homepage, google will know that the pages aren't there anymore... so i doubt they'll keep PR if they don't exist anymore...
But the old pages should transfer their PR to the main page now though shouldn't it? Thanks for your help. Where do you want the $20 donation to go to?
hmm, I don't really know any charities that accept paypal. I only donate to funds that come by the doors.... So you can send it to your favorite charity, or keep it