Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 410A8200CB3 for ; Mon, 26 Jun 2017 22:07:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F79E160BDE; Mon, 26 Jun 2017 20:07:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8579C160BDA for ; Mon, 26 Jun 2017 22:07:16 +0200 (CEST) Received: (qmail 26775 invoked by uid 500); 26 Jun 2017 20:07:15 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 26764 invoked by uid 99); 26 Jun 2017 20:07:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jun 2017 20:07:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E12B1184962 for ; Mon, 26 Jun 2017 20:07:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.002 X-Spam-Level: X-Spam-Status: No, score=-0.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UUxstnZvDoXt for ; Mon, 26 Jun 2017 20:07:12 +0000 (UTC) Received: from tinuviel.sharphosting.uk (tinuviel.sharphosting.uk [85.159.211.145]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 519A55F649 for ; Mon, 26 Jun 2017 20:07:12 +0000 (UTC) Received: from tania.sharphosting.uk (189.214.5.37.cable.dyn.cableonline.com.mx [189.214.5.37]) by tinuviel.sharphosting.uk (Postfix) with ESMTPSA id 33A4D305; Mon, 26 Jun 2017 20:07:06 +0000 (UTC) To: users@httpd.apache.org, Daniel References: From: Nigel Peck Message-ID: <3899048f-d39e-8927-4ae0-facf0a61a4d5@sharphosting.uk> Date: Mon, 26 Jun 2017 15:07:04 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Subject: Re: [users@httpd] redirect vs. rewrite archived-at: Mon, 26 Jun 2017 20:07:17 -0000 Also note that the first one will always redirect to the root of the target domain, but the second one will redirect to the same page on the target domain. First one: (taking Daniel's comment in to account) /example redirects to http://www.domain.com/ Second one: /example redirects to http://www.domain.com/example First one is using mod_alias[1], second one is using mod_rewrite[2]. Mod rewrite has more flexibility and can handle complex situations, for simple cases mod_alias is easier to use. 1 - https://httpd.apache.org/docs/current/mod/mod_alias.html 2 - https://httpd.apache.org/docs/current/mod/mod_rewrite.html On 26/06/2017 14:29, Daniel wrote: > Note the first one (the redirect) will probably redirect incorrectly, > target should end with a trailing slash. > > Golden rule: if souce ends in trailing slash, target must also end in > trailing slash. > > 2017-06-26 21:23 GMT+02:00 Eric Covener : >> On Mon, Jun 26, 2017 at 3:16 PM, David Mehler wrote: >>> I'm using apache 2.4. What is the difference between these lines? >>> >>> Redirect permanent / http://www.domain.com >>> RewriteRule ^/?(.*) http://www.domain.com/$1 [R,L] >> >> Nothing really, when you add the 'R' flag you're asking mod_rewrite to >> redirect instead of performing an internal rewrite of the URL or file >> path. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org >> For additional commands, e-mail: users-help@httpd.apache.org >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org