...

View Full Version : redirecting www. to www3.



pardicity3
03-16-2004, 06:07 PM
On my current host (the university's server) server-side pages (well, php as far as I know) have to be run on a secure server rather than the everyday server. This entails me using the www3 prefix rather than www (i.e. www3.nd.edu rather than www.nd.edu). Now, all is good and well until I realize that if a php page is viewed on the www server the user will see the php code since it is obviously not parsed. So I'm just wondering if there is a quick fix that will redirect any url that starts with www and is a php page to the same url only with a www3 prefix. I hope this makes sense...

edit: On a very similar note, what about redirecting everything to www3? I know .htaccess is probably the best method, but i'm not sure how to utilize it yet.

pardicity3
03-16-2004, 10:15 PM
Well, I semi-thought I had it, but then I realize my solution was stupid. I tried to use RedirectMatch in this way:

RedirectMatch permanent (.*)\.php$ http://www3.nd.edu$1.php

My first realization though was that this would keep redirecting any php pages (regardless of www or www3) due to the fact that they are stored in the same filespace. I also have no idea if this is redirecting to the same location only on the www3 server.... yikes....

Feyd
03-17-2004, 12:14 AM
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www3.domain.com/$1 [R=301,L]

pardicity3
03-18-2004, 11:50 PM
Thanks Feyd, that seems like it should work, but for some reason I am getting a 500 internal server error. I am using the code you provided:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.nd\.edu$ [NC]
RewriteRule ^(.*)$ http://www3.nd.edu/$1 [R=301,L]

If you go to http://www.nd.edu/~mking5/ you will see what is happening. This may just be an issue with the server, and I am contacting those in charge. I just wasn't sure if this was an issue I could deal with myself.

ghell
03-21-2004, 01:37 PM
you could always put a javascript redirector somewhere in the page, but it is still possible to get your source quite easily, if you only give people the link to a html page on www and from ther they can get to www3 it may work.. its still not very secure and Feyd's answer is probably better.. i say probably cos i have no idea what hes talking about :p

maby rename your index.php and insert an index.htm so the directory will not show

me'
03-27-2004, 05:00 PM
Originally posted by pardicity3
If you go to http://www.nd.edu/~mking5/ you will see what is happening. This may just be an issue with the server, and I am contacting those in charge. I just wasn't sure if this was an issue I could deal with myself. Seems to be working fine...

pardicity3
03-27-2004, 09:37 PM
Yep, sorry, forgot to post a follow up. So here it goes:

The university doesn't have the rewrite module for apache installed, thus why I was experiencing issues redirecting. So I ended up just going directly through the technology office and they apparently did their thing and had all incoming www urls redirected to www3.

ghell: Good idea, but that would have required me making a seperate .html page for all of my .php pages, just in case someone tried to go to a remote link and not the home page. The way I now have it a link such as http://www.nd.edu/~mking5/theteam/contact/ will be automatically redirected to http://www3.nd.edu/~mking5/theteam/contact/ .



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum