Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirecting www. to www3.

    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.
    Last edited by pardicity3; 03-16-2004 at 08:53 PM.
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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....
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #3
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www3.domain.com/$1 [R=301,L]
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #5
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    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

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

  • #6
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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/ .
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •