dbrimlow Posted March 27, 2006 Share Posted March 27, 2006 I changed @ 10 of my php pages back to html.I revised the pages with pure css layout and converted the navbar includes insert to an external jscript navbar write.What I want to do is have anyone who bookmarked the php versions of the pages auto-redirected to the new html versions.I am temporarily using a redirect link within the php pages themselves.Thanks,Dave Link to comment https://forums.phpfreaks.com/topic/5943-need-help-redirecting-changed-php-to-html-files/ Share on other sites More sharing options...
Vorotaev Posted April 8, 2006 Share Posted April 8, 2006 [!--quoteo(post=358958:date=Mar 27 2006, 01:51 PM:name=dbrimlow)--][div class=\'quotetop\']QUOTE(dbrimlow @ Mar 27 2006, 01:51 PM) [snapback]358958[/snapback][/div][div class=\'quotemain\'][!--quotec--]I changed @ 10 of my php pages back to html.I revised the pages with pure css layout and converted the navbar includes insert to an external jscript navbar write.What I want to do is have anyone who bookmarked the php versions of the pages auto-redirected to the new html versions.I am temporarily using a redirect link within the php pages themselves.Thanks,Dave[/quote]Place the following in the .htaccess file (if mod_rewrite is available):[code]RewriteEngine onRewriteRule ^/([a-z][A-Z][0-9]-/+).php$ $1.html [R] [/code]That should redirect all .php requests to the respective .html equivalent (page.php should become page.html, index.php should become index.html, guestbook.php should become guestbook.html, and so forth). Link to comment https://forums.phpfreaks.com/topic/5943-need-help-redirecting-changed-php-to-html-files/#findComment-25072 Share on other sites More sharing options...
dbrimlow Posted April 8, 2006 Author Share Posted April 8, 2006 [!--quoteo(post=362849:date=Apr 8 2006, 03:14 PM:name=Vorotaev)--][div class=\'quotetop\']QUOTE(Vorotaev @ Apr 8 2006, 03:14 PM) [snapback]362849[/snapback][/div][div class=\'quotemain\'][!--quotec--]Place the following in the .htaccess file (if mod_rewrite is available):[code]RewriteEngine onRewriteRule ^/([a-z][A-Z][0-9]-/+).php$ $1.html [R] [/code]That should redirect all .php requests to the respective .html equivalent (page.php should become page.html, index.php should become index.html, guestbook.php should become guestbook.html, and so forth).[/quote]Is this a "blanket" conversion of all PHP? I have over 800 php pages and only want to convert specific files. Link to comment https://forums.phpfreaks.com/topic/5943-need-help-redirecting-changed-php-to-html-files/#findComment-25088 Share on other sites More sharing options...
Vorotaev Posted April 8, 2006 Share Posted April 8, 2006 [!--quoteo(post=362866:date=Apr 8 2006, 05:59 PM:name=dbrimlow)--][div class=\'quotetop\']QUOTE(dbrimlow @ Apr 8 2006, 05:59 PM) [snapback]362866[/snapback][/div][div class=\'quotemain\'][!--quotec--]Is this a "blanket" conversion of all PHP? I have over 800 php pages and only want to convert specific files.[/quote]Yes, that would convert URLs for all PHP files. If you wanted to select only a handful of files, it would be better to use:[code]redirectpermanent /oldpage.php http://www.somesite.com/newpage.html [R][/code]Bearing in mind that the former link [u]should[/u] be a path. Link to comment https://forums.phpfreaks.com/topic/5943-need-help-redirecting-changed-php-to-html-files/#findComment-25103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.