Forum Moderators: phranque
Forwarding any request from:
[domain.net...]
to
[folder.domain.net...]
where
$1 is a variable forwarding any file request in question, including all parameters passed to PHP files.
That means, for example, that
[domain.net...]
has to be forwarded or rewritten as
[folder.domain.net...]
and not merely as
[folder.domain.net...]
(which will display nothing)
Can someone give me and hand? i would be glad. Thanks in Advance.
[edited by: jdMorgan at 2:08 am (utc) on Aug. 10, 2004]
[edit reason] Removed specific domain name [/edit]
Welcome to WebmasterWorld [webmasterworld.com]!
Post your code, and we'll take a look. As stated in our Charter, we'll help you get it working, but can't write it for you.
Jim
This one seems to be the most correct of them, IMO.
RewriteCond %{HTTP_HOST}!^folder\.domain\.net [NC]
RewriteCond %{HTTP_HOST}!^$
RewriteRule ^/(.*) [folder.domain.net...] [L,R]
What you have should work, but maybe some other rule is dropping the query string.
How about this?
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^folder\.domain\.net [NC]
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^/(.*) http://folder.domain.net/$1?%1 [R=301,L]
RewriteEngine on
RewriteCond %{QUERY_STRING} (.*) [NC]
RewriteRule ^folder/(.*)$ ht-p://folder.domain.net?%1 [R=301,L]
Why not just put the rules in the root .htaccess folder of site A and forget the HTTP_HOST conditional?
Oh, welcome from me as well!
Birdman
Try following the redirect path by using the server headers checker [webmasterworld.com]. Each time you get an external redirect response, submit the URL that it says it redirected to back into the headers checker, and follow it through step-by-step. Somewhere in the process, you'll see the query string drop off, and that will give you an indication of where to look for the problem.
Jim
and this was what i got:
HTTP/1.1 302 Found
Date: Tue, 10 Aug 2004 16:36:04 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_fastcgi/2.2.10 mod_jk/1.2.0 mod_perl/1.24_01 PHP/4.2.2 FrontPage/5.0.2 mod_ssl/2.8.12 OpenSSL/0.9.6b
Location: [folder.domain.net...]
Connection: close
Content-Type: text/html; charset=iso-8859-1
(I switched the real domain, folder and file name to keep the privacy, once again, thank you so much for the help.)
If you have some kind of funky 'domain pointing' or a shared hosting account (such as mapping subdomains to subdirectories of a common account), and that's not set up right, then that could be the cause. If you are not aware of any redirection that *should* be taking place before your .htaccess file is reached, then I'm afraid you'll have to dig through your DNS setup and your hosting account setup to find this.
Jim
I don't think there is any problem with that, because i've used other codes in the past and they worked, something like this:
RewriteCond %{HTTP_HOST} [^.]*domain\.net$
RewriteRule ^(.*)$ /folder/$1
Worked very good, such as this one:
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?domain.net/.*$ [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png)$ [domain.net...] [R,L]
And they both worked.
What should i do?
No, not at all. I'm saying that for some reason, you are getting a 302 redirect, and it is not the result of the code we've been discussing. So why are you getting a 302? You need to find out where that is happening and why in order to fix this problem.
Sometimes, people that use "domain pointing" services end up with a 302 redirect on every access to their site, and it slows everything down, screws up their serach engine listings, and generally causes problems. Make sure that's not the case here.
Jim