httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MegaBrutal <megabru...@gmail.com>
Subject [users@httpd] RewriteRule vs. Redirection
Date Fri, 09 Nov 2012 07:24:03 GMT
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

Mime
View raw message