httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] detail for a rewrite
Date Sun, 11 Dec 2005 15:35:24 GMT
On 12/11/05, T F <through.the.forest@gmail.com> wrote:

>  In my .htaccess file, the following accomplishes this (but there is a
> glitch)
>
>  RewriteEngine on
>  RewriteCond %{HTTP_HOST}   ^www\.domain\.net [NC]
>  RewriteRule ^$   http://www.domain.net/o/index.html   [R]
>
>  If the user points to http://www.domain.net/o/ (with a trailing slash),
> then everything is fine.
>
>  But if they omit the trailing slash, then the url becomes (note the .com)
> http://www.domain.com/o/

Fixing the UseCanonicalName setting could probably fix that, but it
sounds like you can't access httpd.conf.

>
>  I'd like for the url to remain .net.
>
>  In fact, i'd like to devise a general solution, such that whenever any
> document in the the /o tree is requested, then the url will be rewritten to
> the .net.  For example if the user pointed
> http://www.domain.com/o/file.html, then it would be
> rewritten to http://www.domain.net/o/file.html

In the o/.htaccess:
 RewriteEngine on
 RewriteCond %{HTTP_HOST}   !^www\.domain\.net$ [NC]
 RewriteRule (.*)   http://www.domain.net/o/$1  [R]
(or something like that -- untested).

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


Mime
View raw message