Return-Path: X-Original-To: apmail-httpd-users-archive@www.apache.org Delivered-To: apmail-httpd-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D1A4D26D for ; Fri, 9 Nov 2012 07:24:39 +0000 (UTC) Received: (qmail 77458 invoked by uid 500); 9 Nov 2012 07:24:36 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 77340 invoked by uid 500); 9 Nov 2012 07:24:35 -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 77289 invoked by uid 99); 9 Nov 2012 07:24:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 07:24:32 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of megabrutal@gmail.com designates 209.85.212.45 as permitted sender) Received: from [209.85.212.45] (HELO mail-vb0-f45.google.com) (209.85.212.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 07:24:24 +0000 Received: by mail-vb0-f45.google.com with SMTP id p1so4722269vbi.18 for ; Thu, 08 Nov 2012 23:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=BqHjF+z+8XIGQKY06CSe3aZb/2crbSk9U20zk4CKOcU=; b=gOsV+IvWVnS4ZM6JrPnLMXCQefZh/r1c1p7O+6cm5WLFg06Or2PpJF8do2AGa+I6cK rZr/BTnpgA0GhnAPN1DRynk4KyDQLGC8aBMhiiww5t5V/Kjz2vJbr9TZtK0QIxBJpKN5 rZ5gx/ySmIfA7QE4XelTYxtOGknTWLddHVyRCL2t2YOn9QMwxKKbpoW0V4LnhmCsKzZ/ jay5gyxchOc11AqVE2tVUMQqKSsy1dDX4Xl4i/FpcrrucCvhDwlceXjurhtdoTRa3Qq5 J6353FlrXLYoWiH4iY2oGEPpKLMcFRRSUT/eJBsVMytr7QpuUPtaQJxXQVkxd9cqW1QV mB3w== MIME-Version: 1.0 Received: by 10.59.13.197 with SMTP id fa5mr4475905ved.47.1352445844005; Thu, 08 Nov 2012 23:24:04 -0800 (PST) Received: by 10.58.172.168 with HTTP; Thu, 8 Nov 2012 23:24:03 -0800 (PST) Date: Fri, 9 Nov 2012 08:24:03 +0100 Message-ID: From: MegaBrutal To: users@httpd.apache.org Content-Type: multipart/alternative; boundary=089e0118499c1c237304ce0ad67e X-Virus-Checked: Checked by ClamAV on apache.org Subject: [users@httpd] RewriteRule vs. Redirection --089e0118499c1c237304ce0ad67e Content-Type: text/plain; charset=ISO-8859-1 Hello, Once I've set up an SMF forum in the /forum folder of my webspace. It was all good. Then it turned out, with modules like TinyPortal, actually, we can also implement the main site with SMF too. OK, move SMF to the root from /forum. It was all good. In case others still have permalinks to specific threads, I wanted those URLs to remain valid. Therefore, I added an HTTP redirection from /forum to /, like this: Redirect permanent /forum http://mydomain.tld It worked well, URLs like http://mydomain.tld/forum/index.php/topic,40.0.html got redirected to http://mydomain.tld/index.php/topic,40.0.html Worked as intended, it was all good. But then came the bright idea, let's use SEO-friendly pretty URLs, like http://mydomain.tld/genericsection/randomthread/ - good, we installed a specific mod to handle that. The mod has transformed the address of the forum's main page to http://mydomain.tld/forum - for several hours, we were wondering why does this URL puts us back to the main portal page, instead of showing the forum. It seemed the rewrite rules installed by the mod were OK. Then finally I remembered the redirection I put in, which enlightened the situation. I thought to change the forum URL in the menu bar to http://mydomain.tld/board for example (which shows the forum correctly), but the address is quite much hard-coded in the forum's code, it's a pain to track down all instance - it's better not to confuse the ecosystem. Now I put the redirection to have lower preference than the rewrite rule, but still somehow it still interferes. The 2 directives: RewriteRule ^(board|boards|forum|tpmod|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA] Redirect permanent /forum http://mydomain.tld Although it seems to work, now http://mydomain.tld/forum redirects to http://mydomain.tld/?pretty;action=forum - which is not so pretty, I'm unsatisfied with this. If I remove the Redirect line, the browser stays at http://mydomain.tld/forum which looks better. But I still need the Redirect line, 'cause I still need to redirect those very old links I mentioned at the beginning. So, in short, what I need: http://mydomain.tld/forum -> In this case, ONLY the RewriteRule should apply. http://mydomain.tld/forum/index.php/topic,40.0.html -> In this case, ONLY the Redirect line should apply. It's quite inconvenient that the PrettyURLs mod needs to use /forum coincidentally and so it interferes with my Redirect, but still, I need to cope with it. What are your suggestions? Thanks in advance, MegaBrutal --089e0118499c1c237304ce0ad67e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

Once I've set up an SMF forum in the /forum folder of my = webspace. It was all good. Then it turned out, with modules like TinyPortal= , actually, we can also implement the main site with SMF too. OK, move SMF = to the root from /forum. It was all good. In case others still have permali= nks to specific threads, I wanted those URLs to remain valid. Therefore, I = added an HTTP redirection from /forum to /, like this:

Redirect permanent /f= orum http://mydomain.tld

= It worked well, URLs like
http://mydomai= n.tld/forum/index.php/topic,40.0.html
got redirected to
http://mydomain.tld/index.php/topic,40.0.html

Worked as intend= ed, it was all good.

But then came the bright idea, let's use SE= O-friendly pretty URLs, like
http://mydomain.tld/genericsection/randomthread/ - good,= we installed a specific mod to handle that. The mod has transformed the ad= dress of the forum's main page to http://mydomain.tld/forum - for several hours, we were wondering why d= oes this URL puts us back to the main portal page, instead of showing the f= orum. It seemed the rewrite rules installed by the mod were OK. Then finall= y I remembered the redirection I put in, which enlightened the situation.
I thought to change the forum URL in the menu bar to http://mydomain.tld/board for example (which shows = the forum correctly), but the address is quite much hard-coded in the forum= 's code, it's a pain to track down all instance - it's better n= ot to confuse the ecosystem.

Now I put the redirection to have lower preference than the rewrite rul= e, but still somehow it still interferes. The 2 directives:
RewriteRule ^(board|boards|forum|tpm= od|xmlhttp)/?$ ./index.php?pretty;action=3D$1 [L,QSA]
Redirect permanent /forum http://mydomain.t= ld


Although it seems to work, now=A0http://mydomain.tld/forum redirects to http://mydomain.tld/?pretty;action= =3Dforum - which is not so pretty, I'm unsatisfied with this. If I = remove the Redirect line, the browser stays at http://mydomain.tld/forum which looks better. But I still nee= d the Redirect line, 'cause I still need to redirect those very old lin= ks I mentioned at the beginning.

So, in short, what I need:
htt= p://mydomain.tld/forum -> In this case, ONLY the RewriteRule should = apply.
http://mydomain.tld/forum/index.php/topic,40.0.html -> In this case, ONLY the= Redirect line should apply.

It's quite inconvenient that the PrettyURLs mod needs to use /forum= coincidentally and so it interferes with my Redirect, but still, I need to= cope with it.

What are your suggestions?


Thanks in advan= ce,
MegaBrutal

--089e0118499c1c237304ce0ad67e--