Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: newbie with rewritecond headaches! |
|
Author |
|
tintin
Joined: 22 Jan 2013 Posts: 1 Location: UK, London
|
Posted: Wed 23 Jan '13 13:04 Post subject: newbie with rewritecond headaches! |
|
|
Hello! Have been dropped in the deep end having had no apache/regex experience at all!
Anyway, I have a virtual host with the following working Redirects:
Code: | Redirect HOSTNAME/languagecentre/as/disc/ http://www.library.*****/learning_support/disc
Redirect HOSTNAME/languacecentre/rlf/index.html http://www.library.******/royal_literary_fund
Redirect HOSTNAME/languagecentre/brochures/38530.pdf http://www.library.******/royal_literary_fund |
I now have a request to redirect all requests to HOSTNAME/languagecentre/.* to another server but keep the existing redirects in place, i.e
Code: | Redirect HOSTNAME/languagecentre/as/disc/ http://www.library.*****/learning_support/disc
Redirect HOSTNAME/languacecentre/rlf/index.html http://www.library.******/royal_literary_fund
Redirect HOSTNAME/languagecentre/brochures/38530.pdf http://www.library.******/royal_literary_fund
redirect HOSTNAME/languagecentre/.* http://language-centre.**.uk |
I tried adding
Code: | RewriteRule /languagecentre/.* http://language-centre.**.uk [R,L] |
which works but also redirects the rewrites that I need to keep!
I assume I need to use a RewriteCond to allow the original redirects to continue but any other requests to HOSTNAME to be redirected howver, I don't really know where to start and it's doing my head in!
Hope the above makes sense and any help much appreciated!
Steve |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 04 Mar '13 17:13 Post subject: |
|
|
With mod rewrite you can use %{HTTP_HOST}
see httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond |
|
Back to top |
|
|
|
|
|
|