Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

transparent redirect (like alias) in .htaccess

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Worldpay callback errors  
Author Message
dave25

External


Since: Dec 08, 2004
Posts: 3



(Msg. 1) Posted: Wed Dec 08, 2004 8:26 am
Post subject: transparent redirect (like alias) in .htaccess
Archived from groups: alt>apache>configuration (more info?)

Hi,

I am the administrator of a virtual server, which means I don't get to
edit the apache .conf file, only local .htaccess files in my server's
source tree. I have a file at http://mydomain/foo/bar.hmtl that I need
to show as though it were at http://mydomain/baz.html. Alias is
unavailable in .htaccess files. I've tried RewriteRule, and it
works... but only sort of. All of the relative links in that file end
up relative to http://mydomain/ instead of http://mydomain/foo, so
pictures don't display and links don't work.

I'm wondering if there's a solution for me that I've overlooked, or if
perhaps RewriteRule can be used to get the desired effect if you know
the right tricks. Any advice deeply appreciated. Oh, and:

**** Please Cc: my email address in your reply ****

My news server doesn't seem to carry this group.

Thanks,
Dave

---
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 2) Posted: Wed Dec 08, 2004 1:35 pm
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2004-12-08, dave <dave DeleteThis @boost-consulting.com> wrote:
 > source tree. I have a file at <a style='text-decoration: underline;' href="http://mydomain/foo/bar.hmtl" target="_blank">http://mydomain/foo/bar.hmtl</a> that I need
 > to show as though it were at <a style='text-decoration: underline;' href="http://mydomain/baz.html." target="_blank">http://mydomain/baz.html.</a> Alias is

Create a baz.html file that contains a META tag that redirect
to foo/bar.html.

 > **** Please Cc: my email address in your reply ****

How much do you pay?

 > My news server doesn't seem to carry this group.

Get a better server.

Davide

--
!07/11 PDP a ni deppart m'I !pleH<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
dave25

External


Since: Dec 08, 2004
Posts: 3



(Msg. 3) Posted: Thu Dec 09, 2004 8:16 am
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > Create a baz.html file that contains a META tag that redirect
 > to foo/bar.html.

Then it will show up in browsers (and more importantly, to search
engines) as <a style='text-decoration: underline;' href="http://mydomain/foo/bar.html." target="_blank">http://mydomain/foo/bar.html.</a> That's what I'm trying to
avoid.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
dave25

External


Since: Dec 08, 2004
Posts: 3



(Msg. 4) Posted: Thu Dec 09, 2004 8:23 am
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks, but that has all of the problems with relative links that I
mentioned before. That is,

if http://mydomain/foo/bar.hmtl contains

<a href="mumble.html">link</a>

then when visited via http://mydomain/baz.html, the link now refers
to http://mydomain/mumble.html instead of
http://mydomain/foo/mumble.html

That's the problem I'm trying to solve. For example, if there was a
way to
make RewriteRule conditional on the page that was the source of the
link,
I could arrange for all these links to be properly redirected by
rewriting them
only when the user is visiting http://mydomain/baz.html. But I can't
find that.

Thanks again for your help,
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
leendert

External


Since: Nov 23, 2004
Posts: 20



(Msg. 5) Posted: Thu Dec 09, 2004 8:35 am
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Op Wed, 08 Dec 2004 08:26:04 -0800, schreef dave:
 > I am the administrator of a virtual server, which means I don't get to
 > edit the apache .conf file, only local .htaccess files in my server's
 > source tree. I have a file at <a style='text-decoration: underline;' href="http://mydomain/foo/bar.hmtl" target="_blank">http://mydomain/foo/bar.hmtl</a> that I need
 > to show as though it were at <a style='text-decoration: underline;' href="http://mydomain/baz.html." target="_blank">http://mydomain/baz.html.</a> Alias is
 > unavailable in .htaccess files. I've tried RewriteRule, and it
 > works... but only sort of. All of the relative links in that file end
 > up relative to <a style='text-decoration: underline;' href="http://mydomain/" target="_blank">http://mydomain/</a> instead of <a style='text-decoration: underline;' href="http://mydomain/foo," target="_blank">http://mydomain/foo,</a> so
 > pictures don't display and links don't work.

Try:

RewriteEngine On
RewriteRule ^/(.*) /foo/$1 [L]

Put it in your .htaccess file in your webroot dir.

-leendert bottelberghs<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 6) Posted: Thu Dec 09, 2004 4:35 pm
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"dave" <dave.RemoveThis@boost-consulting.com> schreef in bericht
news:1102609382.641774.83920@f14g2000cwb.googlegroups.com...
Next time leave some of the message you respond to here, to give the (new)
reader a clue of the preceding.

 > Thanks, but that has all of the problems with relative links that I
 > mentioned before. That is,
 > if <a style='text-decoration: underline;' href="http://mydomain/foo/bar.hmtl" target="_blank">http://mydomain/foo/bar.hmtl</a> contains
 > link
 >
 > then when visited via <a style='text-decoration: underline;' href="http://mydomain/baz.html," target="_blank">http://mydomain/baz.html,</a> the link now refers
 > to <a style='text-decoration: underline;' href="http://mydomain/mumble.html" target="_blank">http://mydomain/mumble.html</a> instead of
<font color=purple> > <a style='text-decoration: underline;' href="http://mydomain/foo/mumble.html</font" target="_blank">http://mydomain/foo/mumble.html</font</a>>
 >
 > That's the problem I'm trying to solve.
That's the browser recontructing an fully qualified URL using both the
_relative_ URL and the URL of the page currently displayed.

 > For example, if there was a way to make RewriteRule
 > conditional on the page that was the source of the link,
 > I could arrange for all these links to be properly redirected by
 > rewriting them only when the user is visiting
 > <a style='text-decoration: underline;' href="http://mydomain/baz.html." target="_blank">http://mydomain/baz.html.</a> But I can't find that.
The current page's link is ther referrer for the links in it, so
"RewriteCond %{HTTP_REFERER} ????" shoul be your key.
However, some browsers allow the user to disable sending the referrer ...
hence to solve this issue relieable have the URL start at document root,
like link

HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
dave26

External


Since: Dec 24, 2004
Posts: 1



(Msg. 7) Posted: Fri Dec 24, 2004 2:38 pm
Post subject: Re: transparent redirect (like alias) in .htaccess [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hans,

After lots of experimentation I got that to work -- thank you!

BTW, which browsers allow this referrer disabling, and is it very
common for people to do that and expect websites to work properly? I'd
prefer it if my links continue to work when the documents are browsed
on a local disk so I'm a little reluctant to root all the links in that
file.
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
 >> Stay informed about: transparent redirect (like alias) in .htaccess 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Redirect/Alias, ports - Hi, I am not very good with the Apache configuration and would like to redirect, more likely alias a page like this: I would like that www.mydomain.com/mywebsite2 be an alias to www.mydomain.com:18080. Is it possible ? If I do a url redirect, the add..

Alias in .htaccess - Hi, I have a problem with the . htaccess file. In httpd.conf I define an alias (it's working well). But when I define the same alias in .htaccess (AllowOverride is set to All in httpd.conf) it doesn't work. What could be the error? I'm using Apache..

.htaccess redirect - Is it possible to do something similar to this ... redirect http://www.widget.com/index.html http://www.newwidget.com/index.html If not, an alternative idea? Thanks

htaccess redirect - Hi All I've scoured the net looking for an htaccess file with no luck. I'm really hoping someone will be able to assist me with this. I have a domain that was recently registered. It has a ton of links from other websites to subdomains on my domain. ...

.htaccess redirect - Is there away to do this: If someone comes with yourdomain.com and have a redirect in your ..htaccess to redirect to www.yourdomain.com? Thanks.
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]