werepairitall Posted August 17, 2013 Share Posted August 17, 2013 We have a website with around 1k pages inside it. They all end in .html.. We spent about a year marketing and advertising specific pages of our website all over the net. We are in a process of updating our website, and wish to implement blogs(wordpress) and other useful tools like comments, ratings, etc.. Many of these scripts(widgets) require that the page end in .php in order to make these scripts work. I am trying to keep everything consistent to our advertisement. My question is, is it possible to rename all .HTML files to .PHP and still keep the advertising links? Without having to go to all of our advertising pages and change links..? If so, what would this process be called.. I heard of sync linking and meta refresh, but not sure if this is what we need. Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/ Share on other sites More sharing options...
Solution kicken Posted August 17, 2013 Solution Share Posted August 17, 2013 (edited) If all the links follow a defined pattern that you can generate a regex for, then you can use mod_rewrite to redirect them. Eg: RewriteEngine On RewriteRule /page/(.*)\.html /page/$1.php [R=301,L] If there is no defined pattern, you can just take the individual URLs and redirect them using the Redirect directive. Redirect permanent /page/whatever.html http://www.example.com/page/whatever.php Redirect permanent /someotherpage/blah.html http://www.example.com/someotherpage/blah.php These would go in your .htaccess or apache config file. If your using a server other than apache, you'll need to research how that server handles redirecting. Edited August 17, 2013 by kicken Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445550 Share on other sites More sharing options...
werepairitall Posted August 17, 2013 Author Share Posted August 17, 2013 (edited) No sure what you mean by 'defined pattern'. But I will explain what I mean. I have a link to my website http://www.angelgaragedoors.com/services/garage-door-repair-arcadia.html which I have posted on craigslist. If I rename the file extension in my hosting account to .php, what would be the best way to go around this so visitors will not get a 404 error? I have over 1000 service pages like this which are advertised all over.. I have .htaccess on my hosting (godaddy) Edited August 17, 2013 by werepairitall Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445553 Share on other sites More sharing options...
kicken Posted August 17, 2013 Share Posted August 17, 2013 By defined pattern, I mean there is something common to all URLs which can be used to match them. For example, if they all begin with /services/ and end in .html with only the middle bit changing then you could match all of them using the regex: /services/(.*)\.html. You can then use that pattern in the mod_rewrite solution described above. Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445555 Share on other sites More sharing options...
werepairitall Posted August 17, 2013 Author Share Posted August 17, 2013 ah gotcha, you think re-direct will affect my SEO? Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445558 Share on other sites More sharing options...
kicken Posted August 17, 2013 Share Posted August 17, 2013 No, with a proper 301 (Permanent) redirect google and other search engines should transfer any ranking data from the old URL to the new URL Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445560 Share on other sites More sharing options...
werepairitall Posted August 17, 2013 Author Share Posted August 17, 2013 Ah ok, great! Thanks for you help! Quote Link to comment https://forums.phpfreaks.com/topic/281281-renaming-html-to-php-after-advertising-bad-idea/#findComment-1445563 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.