Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

Old/new versions of site.
Welcome, Guest. Please login or register.
December 02, 2008, 02:11:28 PM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Webservers  |  Apache  |  Old/new versions of site. « previous next »
Pages: [1]
Author Topic: Old/new versions of site.  (Read 1189 times)
Anonymous
Guest
« on: February 03, 2006, 03:02:05 AM »

Hi.

I'm not an Apache user (also not an IIS user).

Imagine a part of a site which is currently accessed as http://www.site.com/part_V1/index.html

The file index.html is installed as /home/www/site/public_html/part_V1/index.html

Now I want to develop the next version of the site in /home/www/site/public_html/part_V2/index.html

All links on the site are relative.

I want to provide an internal redirection so that instead of the URL having part_V1 in it, it just uses part.

I then want to be able to change the redirector to use V2 when testing is complete and the users REALLY get their hands on the new site.

If there is a problem, I just change the redirect back to V1.

The URL doesn't change.

I suspect this is done in the .htaccess file, but I'm not sure what/how/etc.

Time for me to learn from those who know.
Logged
COBOLdinosaur
ERT.com Admin

Offline Offline

Posts: 481



WWW
« Reply #1 on: February 03, 2006, 05:03:33 AM »

We do a bunch of re-directs through the .htaccess her on the site:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^expertsrt\.com [NC]
RewriteRule ^(.*)$ http://www.expertsrt.com/$1 [R=301,L]
Redirect /home.html http://www.expertsrt.com/
Redirect /home.shtml http://www.expertsrt.com/
Redirect /home.php http://www.expertsrt.com/
Redirect /index.html http://www.expertsrt.com/index.php
ErrorDocument 404 /404.html


The first two lines bring expertsrt.com into the right subdomain www.expertsrt.com.

Then the Redirects are page Redirects for page that have been removed or renamed.  Instead of changing the links all over the site I just add the redirected pages to the .htaccess file.  If the site is using all relative links, use a sub-domain and it is a snap, because don't even need .htaccess file.

When we had the beta site up I just changed teh entry url from http://www.expertsrt.com/phpBB@/ to http://beta.expertsrt.com/forum/

With relative links nothing else has to change, but in the case of ERT there are mostly absolute links generaed by php, so I had to change a global variable tha contains the root path  becaue msot links look like: $phpbb_root . 'page.php'

There were still a couple of pages where I had to use client script to prevent access to page that did not follow the normal conventions, but that problem is the result of of inconsistent coding and stupidity, that yo run across sometimes in PHPBB.

Did that help?

 :^)

Cd&
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #2 on: February 03, 2006, 05:42:22 AM »

In fact, you've multiple solutions not even related to the actual web server (and the mod_rewrite module of Apache seen above).

You could, for instance, manually set up the redirection for testing purposes, and manually set it back if it fails.
You could even set it up automatically, and why not only for some users, or some IP addresses ranges.

All this is relatively simple.

It could also be done in a "prepended file", if you see what I mean.

One example :
- filesystem level solution : rename old site's directopry, create a soft link with that name that points to the new site's directory
Esay and efficient, but manual and cumbersome on Windows

- application level : suppose you've PHP.
You could use header(), conditionnally or not (use $_SERVER['REMOTE_ADDR'] or the login provided after authentication), to redirect people to the new site when they access the old one.
Commenting the line out suppresses the redirection.
Simple and trivial.

There is a whole range of solutions in between.

tell me if this helped a bit.

regards
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
nicholassolutions
Administrator
*
Offline Offline

Posts: 133



WWW
« Reply #3 on: February 03, 2006, 08:53:57 AM »

you could also just make a link (i.e. shortcut in the file system). I've used this on my site quite a few times so that several URLs point to the same place, and I can easily see this from the command prompt as well. It is nice because you don't need to rename the actual folders or change anything about the 'physical' set up of your server.

Code:
prompt> ln -s /home/www/site/public_html/part_V2 /home/www/site/public_html/part


if the user visits the corresponding URL
http://www.yoursite.com/part/
they will see what is ACTUALLY located at
http://www.yoursite.com/part_V2/
obviously if you need to change back to version 1, it is as simple as
Code:
prompt>ln -s /home/www/site/public_html/part_V1 /home/www/site/public_html/part


obviously the link part and part_Vx dont need to be in the same folder.
Logged
nicholassolutions
Administrator
*
Offline Offline

Posts: 133



WWW
« Reply #4 on: February 03, 2006, 09:05:42 AM »

In case you looked, I had a mistake in my original post - I'd reversed the order of link/file, and forgot that you need ths -s flag to point to directories...Sorry about that...
Logged
VGR
Mentor

Offline Offline

Posts: 682



WWW
« Reply #5 on: February 03, 2006, 12:02:30 PM »

yes ;-) and isn't my suggestion "soft link" exactly the "ln -s" ? ;-)
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
nicholassolutions
Administrator
*
Offline Offline

Posts: 133



WWW
« Reply #6 on: February 03, 2006, 12:05:30 PM »

yes indeed....I was trying to steal your poinks  :glasses7:
Logged
Anonymous
Guest
« Reply #7 on: February 06, 2006, 02:41:38 AM »

In the end I've just used a redirect ...

Redirect /phpMyAdmin http://xxxxx/phpMyAdmin-2.7.0-pl2/
Redirect /phpmyadmin http://xxxxx/phpMyAdmin-2.7.0-pl2/
Redirect /phpMyAdmin/ http://xxxxx/phpMyAdmin-2.7.0-pl2/
Redirect /phpmyadmin/ http://xxxxx/phpMyAdmin-2.7.0-pl2/

Redirect /phpMyAdmin/beta http://xxxxx/phpMyAdmin-2.8.0-beta1/
....

Lots of combinations of case. I suppose with the rewrite rule, I could ignore the case.
Logged
Pages: [1]
« previous next »
    Jump to: