You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by MarcelSmeets <m....@snow.nl> on 2006/04/04 09:32:47 UTC

[users@httpd] Redirects in .htaccess or virtual hosts

Hi,

I have a redirect question. In the .htaccess file we use on one of our
servers we want about 400 redirects of the form

Redirect /anyplace/anyfile /anotherplace/anotherfile

And this for about 20 virtual hosts ( so 20 .htaccess files)

I have searched everywhere, but apache requires this form

Redirect /anyplace/anyfile http://qualified-url/someplace/somefile

And this is rather a maintenance-problem. All the .htaccess-files need
different qualified-url in the redirected link and if you change things in
one you just can not copy the changed .htaccess but have to change all the
files manually.

Does anybody know an easy work-around or genius solution for this?

Tnx

--
View this message in context: http://www.nabble.com/Redirects-in-.htaccess-or-virtual-hosts-t1391542.html#a3739937
Sent from the Apache HTTP Server - Users forum at Nabble.com.


---------------------------------------------------------------------
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] Redirects in .htaccess or virtual hosts

Posted by Joshua Slive <jo...@slive.ca>.
On 4/4/06, MarcelSmeets <m....@snow.nl> wrote:
> In addition to the remark of the second answer, mod_rewrite does the rewrite
> of the path to a url dynamically, how?? That would be the answer to the
> question!!

You can use an explicit [R] flag to force an external redirect on a
relative url-path, or you can explicitly use the %{SERVER_NAME}
variable in the target.

Joshua.

---------------------------------------------------------------------
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] Redirects in .htaccess or virtual hosts

Posted by MarcelSmeets <m....@snow.nl>.
In reply to the answers before:

I have about 20 virtual hosts and the redirects are not the virtual hosts
themselves but some 400 redirected files / locations which can change very
often: 
Like this:

http:/url/thislocation to http:/url/thatlocation

and that for url1 to url20

In addition to the remark of the second answer, mod_rewrite does the rewrite
of the path to a url dynamically, how?? That would be the answer to the
question!!

Let's see it and I believe you immediately :-)





--
View this message in context: http://www.nabble.com/Redirects-in-.htaccess-or-virtual-hosts-t1391542.html#a3744874
Sent from the Apache HTTP Server - Users forum at Nabble.com.


---------------------------------------------------------------------
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] Redirects in .htaccess or virtual hosts

Posted by Joshua Slive <jo...@slive.ca>.
On 4/4/06, MarcelSmeets <m....@snow.nl> wrote:
>
> Hi,
>
> I have a redirect question. In the .htaccess file we use on one of our
> servers we want about 400 redirects of the form
>
> Redirect /anyplace/anyfile /anotherplace/anotherfile
>
> And this for about 20 virtual hosts ( so 20 .htaccess files)
>
> I have searched everywhere, but apache requires this form
>
> Redirect /anyplace/anyfile http://qualified-url/someplace/somefile
>
> And this is rather a maintenance-problem. All the .htaccess-files need
> different qualified-url in the redirected link and if you change things in
> one you just can not copy the changed .htaccess but have to change all the
> files manually.
>
> Does anybody know an easy work-around or genius solution for this?

mod_rewrite can set this dynamically.

And I believe that the newest versions of apache will allow a
non-fully-qualified url, but I can't remember for sure.

Joshua.

---------------------------------------------------------------------
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] Redirects in .htaccess or virtual hosts

Posted by Jerry McAllister <je...@clunix.cl.msu.edu>.
> 
> Hi,
> 
> I have a redirect question. In the .htaccess file we use on one of our
> servers we want about 400 redirects of the form
> 
> Redirect /anyplace/anyfile /anotherplace/anotherfile
> 
> And this for about 20 virtual hosts ( so 20 .htaccess files)
> 
> I have searched everywhere, but apache requires this form
> 
> Redirect /anyplace/anyfile http://qualified-url/someplace/somefile
> 
> And this is rather a maintenance-problem. All the .htaccess-files need
> different qualified-url in the redirected link and if you change things in
> one you just can not copy the changed .htaccess but have to change all the
> files manually.
> 
> Does anybody know an easy work-around or genius solution for this?

Maybe I don't understand what you are saying, but I don't understand
why you need redirects for virtual hosts.  Why don't you just make
the virtual host document root point right to where you want it in 
the first place?

////jerry

> 
> Tnx
> 
> --
> View this message in context: http://www.nabble.com/Redirects-in-.htaccess-or-virtual-hosts-t1391542.html#a3739937
> Sent from the Apache HTTP Server - Users forum at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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