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

[subdomain redirect without breaking pre-existing relative..

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  VirtualHost -- all resolving to one :-(  
Author Message
jones

External


Since: Jul 18, 2003
Posts: 4



(Msg. 1) Posted: Tue Jul 22, 2003 2:41 am
Post subject: [subdomain redirect without breaking pre-existing relative links] Re: ?HOWTO re
Archived from groups: alt>apache>configuration (more info?)

Possible to do a subdomain redirect by an explicit mod_alias redirect statement? Is there a way
around mod_rewrite mangling (i.e. rewriting) the relative links in code under the subdomain folder?

Attempts to accomplish an internal redirect of a subdomain <a style='text-decoration: underline;' href="http://ChurchOfGod.Churches.org" target="_blank">http://ChurchOfGod.Churches.org</a>
to <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchOfGod" target="_blank">http://www.Churches.org/ChurchOfGod</a> break relative links in the following manner:

[Mon Jul 21 22:54:40 2003] [error] [client 199.199.199.199] File does not exist:
/var/www/html/ChurchOfGod/css/
churches.css

The rewrite (see below) works to get me to the right subdirectory, but then pathnames to relative
links and includes are mangled. The actual relative link above should have been
"/var/www/html/css/churches.css" and of course fixing the link for the rewrite would break them
for code under <a style='text-decoration: underline;' href="http://www.churches.org/ChurchOfGod" target="_blank">www.churches.org/ChurchOfGod</a>

I'm guessing this is a common problem, but I'm missing something in my interpretation of relavant
previous posts. Is a php or cgi script required (same problems likely?) or could some combination
of NameVirtualHost or mod_alias handle it?

 >
 >On Fri, 18 Jul 2003 22:06:36 -0400, Jones <jones.DeleteThis@justjones.org> wrote:
  >>Can you please describe a strategy for accomplishing the following?
  >> redirect <a style='text-decoration: underline;' href="http://ChurchOfGod.Churches.org" target="_blank">http://ChurchOfGod.Churches.org</a> to <a style='text-decoration: underline;' href="http://" target="_blank">http://</a> <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchOfGod" target="_blank">www.Churches.org/ChurchOfGod</a>
 >v
 >Per your hint to look at mod_rewrite to implement "User Virtual Hosts"
 >I was able to implement subdomains using that method, *but* I have
 >to duplicate the [unknown] way subdomains were implemented on another
 >box to accomodate someone else's code. This method resulted in an
 >extra subdomain name being put in all the includes and relative links,
 >so <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchofGod" target="_blank">www.Churches.org/ChurchofGod</a> works great, but ChurchofGod.Churches.org
 >gets me to the right subdirectory, but then all relative links and includes are
 >broken. that is: It results in includes which should look like this
 >
 >../images or ../includes
 >
 >showing up in the error_log as file not found ../ChurchOfGod/images
 >or ../ChurchOfGod/includes, etc.
 >v
 >Is there another way? I need to 2nd guess someone else's implementation
 >of subdomains.
 >
 >RewriteEngine on
 >RewriteCond %{HTTP_HOST} [^.]+\.churches\.org$
 >RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
 >RewriteRule ([^.]+)\.churches\.org(.*) /$1$2
 >
 >#
 ># This should be changed to whatever you set DocumentRoot to.
 >#
 ><Directory "/var/www/html">
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: [subdomain redirect without breaking pre-existing relative.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Subdomain - Hello, I run Apache 2 on my home machine. I have a DDNS service provider (ZoneEdit) that associates my dynamic IP address to my domain. What I am wondering is how I can create subdomains? Is that done with Apache? I am looking for something like: ..

resolve subdomain to a different domain? - Hello, I run a highly-visible public-facing web service for a number of clients, who incorporate skinned versions of my service into their sites. Typically this is done by them adding a link to clientname.myserver.com to their site navigation. However,....

redirect - Hi , I have apache in my win2000 for server web with +/- 60 sites. I must set config for this : All people that connect to my fixed ip to external must redirect to dir : /public/ Only the local pc can navigate inside all server dir ??? Thks

Redirect permanent? - Would this work as a redirect? Redirect permanent "CONNECT *:25" http://127.0.0.1:25 Or should I just leave apache to give 405 errors? -- del 8-) http://www.foodel.org.uk http://www.diverdel.org.uk

puzzled with redirect - I want to redirect everyting that goes to http://myweb.TLD/foo/bar/ to http://otherweb.TLD/foobar/index.php?page=getfirstpage what I mean is that no matter if they look for /foo/bar/index.html or /foo/bar/subdir/blah.txt they always get redirected to th...
   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 ]