You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by James Moe <ji...@sohnen-moe.com> on 2011/05/07 22:48:18 UTC

[users@httpd] Help with simple mod_rewrite

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
  I thought that this little URL rewrite would be oh-so-simple. I have
not gotten it to work; it is completely ignored.
  I wish to redirect any URL <http://fb.example.com/*> to
<http://example.com/*?fb=1>.

  In <.htaccess>:
RewriteEngine on
RewriteRule ^/(.*)  http://example.com/$1?fb=1 [R,L]

  Where did I go wrong?

- -- 
James Moe
moe dot james at sohnen-moe dot com
520.743.3936
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3FsBIACgkQzTcr8Prq0ZNOOgCeNrXY4tAUIzYVAvROgrcJx4ag
UGMAoLJSilgWg9GaSVYBew7ylFMGSFnH
=b4kg
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] Help with simple mod_rewrite

Posted by James Moe <ji...@sohnen-moe.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/07/2011 04:18 PM, --[ UxBoD ]-- wrote:
>>   I wish to redirect any URL <http://fb.example.com/*> to
>> <http://example.com/*?fb=1>.
>>
>>   In <.htaccess>:
>> RewriteEngine on
>> RewriteRule ^/(.*)  http://example.com/$1?fb=1 [R,L]
>>
>>   Where did I go wrong?
> 
> How about:
> RewriteCond %{HTTP_HOST} = fb.example.com
> RewriteRule ^ http://example.com%{REQUEST_URI}?fb=1 [R=301,L]
>
  After I deleted the "=" in the RewriteCond string, it works as I expected.
  Thanks!

- -- 
James Moe
moe dot james at sohnen-moe dot com
520.743.3936
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3F2GQACgkQzTcr8Prq0ZPOHQCgoLV2Ia6bfy0UnmhUvL6FtdOm
XKsAn0X2VVxU87zC2wpMmyMl/i8FNvn7
=vAqy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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] Help with simple mod_rewrite

Posted by "--[ UxBoD ]--" <ux...@splatnix.net>.
----- Original Message -----
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
>   I thought that this little URL rewrite would be oh-so-simple. I
>   have
> not gotten it to work; it is completely ignored.
>   I wish to redirect any URL <http://fb.example.com/*> to
> <http://example.com/*?fb=1>.
> 
>   In <.htaccess>:
> RewriteEngine on
> RewriteRule ^/(.*)  http://example.com/$1?fb=1 [R,L]
> 
>   Where did I go wrong?
> 

How about:
RewriteCond %{HTTP_HOST} = fb.example.com
RewriteRule ^ http://example.com%{REQUEST_URI}?fb=1 [R=301,L]
-- 
Thanks, Phil

---------------------------------------------------------------------
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