You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Campbell, Lance" <la...@illinois.edu> on 2008/06/24 21:07:36 UTC

[users@httpd] Apache RedirectMatch or Virtual Host Help Needed

I am completely stumped on how to solve a particular problem on Apache
2.2.

 

I have a virtual host for all variations of uiuc.edu for the campus web
server redirecting to "Illinois.edu".  It works great.  Below is some of
the virtual host info I am using.

 

<VirtualHost *:80>

  ServerName uiuc.edu

  ServerAlias www.uiuc.edu www.uiuc.net uiuc.net www.uiuc.org uiuc.org
campus.webtools.uiuc.edu

 

        RedirectMatch (/(.*))?$ http://illinois.edu/$2

 

</VirtualHost>

 

 

I then copied the above and modified it so that I could redirect all
content going to www.illinois.edu <http://www.illinois.edu/>  and
redirect it to illinois.edu.  This is where the problem resides.  When a
user goes to http://www.illinois.edu/index.html they will be redirected
to http://illinois.edu <http://illinois.edu/> /index.html.  Great!  But
none of the JavaScript includes on the index web page that start with
www.illinois.edu <http://www.illinois.edu/>  will render.  If the
JavaScript include starts with either uiuc.edu or illinois.edu then they
render fine.

 

My virtual host for www.illinois.edu looks like:

 

<VirtualHost *:80>

  ServerName www.illinois.edu              

  ServerAlias www.illinois.edu               

 

        RedirectMatch (/(.*))?$ http://illinois.edu/$2

 

</VirtualHost>   

 

Any thoughts on how I can resolve this issue?

 

In order to get this to currently work, I put www.illinois.edu
<http://www.illinois.edu/>  in the Server Alias section in the
Illinois.edu virtual host.  Now if someone comes to the home page with
www.illinois.edu <http://www.illinois.edu/>  they stay within that
domain.  Ideally I would like to redirect them to Illinois.edu.  

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

My e-mail address has changed to lance@illinois.edu

 


RE: [users@httpd] Apache RedirectMatch or Virtual Host Help Needed

Posted by "Campbell, Lance" <la...@illinois.edu>.
The solution is:

RewriteCond %{REQUEST_FILENAME}   !\.(js) [NC]
RewriteCond %{HTTP_HOST}   !^illinois\.edu [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://illinois.edu/$1 [L,R=301]

I pieced this solution together from a couple of different examples that
solved unrelated problems.

Thanks,

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
My e-mail address has changed to lance@illinois.edu
 

-----Original Message-----
From: Campbell, Lance [mailto:lance@illinois.edu] 
Sent: Tuesday, June 24, 2008 2:31 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Apache RedirectMatch or Virtual Host Help
Needed

Actually we have confirmed that the redirect of content works in all
browsers for HTML content.  But for redirecting of JavaScript only IE7
seems to have an issue.  It won't display the .js files.



Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
My e-mail address has changed to lance@illinois.edu
 

-----Original Message-----
From: Krist van Besien [mailto:krist.vanbesien@gmail.com] 
Sent: Tuesday, June 24, 2008 2:13 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache RedirectMatch or Virtual Host Help
Needed

On Tue, Jun 24, 2008 at 21:07, Campbell, Lance <la...@illinois.edu>
wrote:

> I then copied the above and modified it so that I could redirect all
content
> going to www.illinois.edu and redirect it to illinois.edu.  This is
where
> the problem resides.  When a user goes to
http://www.illinois.edu/index.html
> they will be redirected to http://illinois.edu/index.html.  Great!
But none
> of the JavaScript includes on the index web page that start with
> www.illinois.edu will render.  If the JavaScript include starts with
either
> uiuc.edu or illinois.edu then they render fine.

Are the Javascript files that are included loaded by the browser? Are
they present where the browser expects them? Have a look in the log of
your webserver. I can also suggest using the excellent "Firebug" add
on for Firefox, which can show you a lot of what happens when you load
a page.

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache RedirectMatch or Virtual Host Help Needed

Posted by "Campbell, Lance" <la...@illinois.edu>.
Actually we have confirmed that the redirect of content works in all
browsers for HTML content.  But for redirecting of JavaScript only IE7
seems to have an issue.  It won't display the .js files.



Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
My e-mail address has changed to lance@illinois.edu
 

-----Original Message-----
From: Krist van Besien [mailto:krist.vanbesien@gmail.com] 
Sent: Tuesday, June 24, 2008 2:13 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache RedirectMatch or Virtual Host Help
Needed

On Tue, Jun 24, 2008 at 21:07, Campbell, Lance <la...@illinois.edu>
wrote:

> I then copied the above and modified it so that I could redirect all
content
> going to www.illinois.edu and redirect it to illinois.edu.  This is
where
> the problem resides.  When a user goes to
http://www.illinois.edu/index.html
> they will be redirected to http://illinois.edu/index.html.  Great!
But none
> of the JavaScript includes on the index web page that start with
> www.illinois.edu will render.  If the JavaScript include starts with
either
> uiuc.edu or illinois.edu then they render fine.

Are the Javascript files that are included loaded by the browser? Are
they present where the browser expects them? Have a look in the log of
your webserver. I can also suggest using the excellent "Firebug" add
on for Firefox, which can show you a lot of what happens when you load
a page.

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache RedirectMatch or Virtual Host Help Needed

Posted by Krist van Besien <kr...@gmail.com>.
On Tue, Jun 24, 2008 at 21:07, Campbell, Lance <la...@illinois.edu> wrote:

> I then copied the above and modified it so that I could redirect all content
> going to www.illinois.edu and redirect it to illinois.edu.  This is where
> the problem resides.  When a user goes to http://www.illinois.edu/index.html
> they will be redirected to http://illinois.edu/index.html.  Great!  But none
> of the JavaScript includes on the index web page that start with
> www.illinois.edu will render.  If the JavaScript include starts with either
> uiuc.edu or illinois.edu then they render fine.

Are the Javascript files that are included loaded by the browser? Are
they present where the browser expects them? Have a look in the log of
your webserver. I can also suggest using the excellent "Firebug" add
on for Firefox, which can show you a lot of what happens when you load
a page.

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org