Jump to content

How to create a 2nd temporary index page?


Chrisj

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.