TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Redirecting site to temporary folder (http://www.talkphp.com/general/5006-redirecting-site-temporary-folder.html)

Jmz 10-07-2009 01:28 PM

Redirecting site to temporary folder
 
I'm going to be updating one of my sites soon. The new site will be running on WordPress and I'd like to redirect users to a temporary site I have made while I get everything set up for my new site.

The temporary site is located in a folder called temp. I tried using htaccess to redirect anyone that goes to mydomain.com to mydomain.com/temp. My .htaccess file looks like this:

Code:

DirectoryIndex test.php
That sends them to test.php which then redirects them to mydomain.com/temp using a 301 redirect.

However, now I have installed WordPress in the root folder of my domain even if I go to mydomain.com/index.php I am still redirected to the temp folder.

What is the best way to do this so that I can still work on my site whilst users are redirected to the temp site

ioan1k 10-07-2009 01:57 PM

Easiest thing to do ....

Keep the old site in the root directory and develop and test your new one in something like /dev or on a subdomain dev.domain.com, once everything works then move it over to the root :)

It's much easier than trying to redirect this and that way and when its time to migrate you only need to update a few settings in wordpress, instead of messing around with htaccess

Jmz 10-07-2009 06:50 PM

Thanks, I was hoping there would be a simple way with .htaccess.

I'll just do it your way ^^

adamdecaf 10-07-2009 10:19 PM

Here is what I do.

Currently I host more than one site on the same server so this is my structure.

Code:

/
/SITE_1/
  /BLOG/ <-- blog.example.com
  /SITE/ <-- The main directory for .example.com
/SITE_2/
 /BLOG/  <-- blog.example.net
 /SITE/  <-- .example.net

What I suggest doing is something like this.

Code:

/
/SITE/
  /BLOG/ <-- blog.example.com
  /SITE/ <-- The main directory for .example.com
  /NEW/ <-- dev.example.com

Then when you're ready to change over just delete /SITE/ and rename /NEW/ -> /SITE/ and you will be fine. The downtime should be under a minute.

Jmz 10-08-2009 01:51 PM

That's a pretty good idea :)

How do you tell the server to use the 'site' folder as the main folder? htaccess?

adamdecaf 10-08-2009 10:22 PM

Quote:

Originally Posted by Jmz (Post 28759)
That's a pretty good idea :)

How do you tell the server to use the 'site' folder as the main folder? htaccess?

If you use a hosting panel then inside the "Domains" section there should be a spot to tell each domain (and subdomain) where to located the root directory on the file server.

If you're trying to do it directly on the Apache HTTP web server then you will need to edit the httpd.conf or vhosts.conf file and change the VirtualHosts. If you run into and issues there are many people here who can answer any questions about the VirtualHosts (or Control Panel).

Jmz 10-09-2009 07:49 AM

I'm using plesk but I'm not sure how to change the default folder, or even if it's possible.

I have a few sites on the same server so I need to make sure anything I change only changes for this account.


All times are GMT. The time now is 09:01 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0