Chrisj Posted August 10, 2010 Share Posted August 10, 2010 I'm using a popular PHP script for my web site, which uses main_1.htm for the header and footer, and inner_index.htm for the main part of the home page. Also, of course it has index.php. How can I set up a duplicates of these files to work on and test changes to the home page, before I actually deploy the changes on to my live site's home page? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/ Share on other sites More sharing options...
Adam Posted August 10, 2010 Share Posted August 10, 2010 Why not develop them locally, then upload to your remote/production server once you're happy? Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097575 Share on other sites More sharing options...
meltingpoint Posted August 10, 2010 Share Posted August 10, 2010 Chrisj I would utilize .htaccess (if you are allowed to by your server) DirectoryIndex redirect. You can find it here: http://www.javascriptkit.com/howto/htaccess6.shtml Then when you are done testing- simply remove that line from the .htaccess Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097576 Share on other sites More sharing options...
Adam Posted August 10, 2010 Share Posted August 10, 2010 That will only change the default index page from index.html to whatever is specified. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097578 Share on other sites More sharing options...
meltingpoint Posted August 10, 2010 Share Posted August 10, 2010 Mr. Adam- Yes. Create duplicates and name them index1.html etc... Then re-direct traffic to that page while you do testing on the true index.html. Once satisfied- remove the .htaccess and the other files or keep them for future testing. Sorry if that was not clear. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097594 Share on other sites More sharing options...
Adam Posted August 10, 2010 Share Posted August 10, 2010 Why go to so much trouble when you could simply just modify it locally though? Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097597 Share on other sites More sharing options...
meltingpoint Posted August 10, 2010 Share Posted August 10, 2010 I like working with the site/structure/settings that are on the live site. That gives me the best and most accurate testing. If my local environment is not exactly like my live host- then there could be problems that I will not see. I actually do both at times. But prefer the live host testing. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097611 Share on other sites More sharing options...
Chrisj Posted August 10, 2010 Author Share Posted August 10, 2010 Thanks for those replies. Live host testing would be preferable because I need to know the changes work with the script. Such as making changes to the search functioning. As I've named the files in my first post, would you be interested in giving me an example of what I would add to the .htaccess file? Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097620 Share on other sites More sharing options...
theloki Posted August 10, 2010 Share Posted August 10, 2010 or what about just running it from a folder then dont have to do any messing around Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097627 Share on other sites More sharing options...
meltingpoint Posted August 10, 2010 Share Posted August 10, 2010 Chrisj 1- Create duplicates of your pages to something like; index2.php main_2.htm inner_index2.htm **Make sure to change the includes in index2.php to reflect the new pages Then to open your existing .htaccess file and add; DirectoryIndex index2.php save and close. *If you don't have a .htaccess file simply google "create .htaccess file" Upload/publish to your site. Now anyone who goes to www.yoursite.com will be re-directed to index2.php and will be able to continue using your site with no problems. You however can do all the testing you want on your original index page and no one will see it until your done. When complete, simply delete that line from the .htaccess file. *Note to access your original index.php for testing you will need to type it in your browser www.yoursite.com/index.php Or as theloki suggests- simply create a folder on your server named testing. Then copy your original index.php, main_1.htm and inner_index to that folder. Now when you go to www.yoursite.com/testing you will be presented with the index.php. This works if you simply want to change the look and feel of your site and are not actually changing links and utilizing other includes() etc... Hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097639 Share on other sites More sharing options...
JonnoTheDev Posted August 10, 2010 Share Posted August 10, 2010 Simple answer. Always use a dev environment and a live environment. 2 identical copies of the same application. Your live site is on http://www.mywebsite.com Your dev website is on http://dev.mywebsite.com Both are on the same server. When making modifications, make them only on your dev platform. When you are happy simply use a copy command to transfer the files into the document root of the live website. Do not go down the route of using test files in your live environment i.e index2.php, test.php, index-test.php, etc. This will result in your document root becoming messy, also direct changes to live files may result in unforseen errors to end users currently viewing your website. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097641 Share on other sites More sharing options...
meltingpoint Posted August 10, 2010 Share Posted August 10, 2010 Won't you have to change all your links? Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097674 Share on other sites More sharing options...
JonnoTheDev Posted August 10, 2010 Share Posted August 10, 2010 Won't you have to change all your links? No, links should be relative, or if they are absolute use a url definition in a common include configuration file. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097795 Share on other sites More sharing options...
meltingpoint Posted August 11, 2010 Share Posted August 11, 2010 which is overall better to use- relative links or absolute? I use a WYSIWYG program to create web pages (Pablo Software WYSIWYG). So, like most of these types of programs, I am given a box to enter an absolute or relative link. If I were to use an absolute link- do you have an idea how I could utilize the url definition that you referenced? Also- is there a security risk for using relative links vs. absolute? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097924 Share on other sites More sharing options...
Festy Posted August 11, 2010 Share Posted August 11, 2010 Why go to so much trouble when you could simply just modify it locally though? because local and server configurations could be different. And if something works on local environment, doesn't mean it will work on server environment too. For e.g. your could be using windows locally while the server platform is Linux. Also there could be different versions of PHP and one version may not be compatible for your script. Quote Link to comment https://forums.phpfreaks.com/topic/210335-how-to-create-a-2nd-temporary-index-page/#findComment-1097955 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.