Forum Moderators: mack

Message Too Old, No Replies

Problem with redirection

         

soori

11:19 pm on Nov 3, 2006 (gmt 0)

10+ Year Member



Hi all.
I have a problem with redirection.
I have installed a wordpress blog in a directory named blog
Also installed phpbb fourm in 'forum' directory

My problem is though after proper redirection in cpanel,whenever i click [forum.mysite.com...] or [mysite.com...] the page gets redirected to [mysite.com...]

Please help me asap

my .htaccess
file reads like this

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /home-page/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /home-page/index.php [L]
</IfModule>

# END WordPress

RedirectMatch permanent ^/forum/index.php$ http://www.mysite.com/forum/index.php

RedirectMatch permanent ^/$ http://mysite.com/blog

whoisgregg

12:56 am on Nov 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com], soori!

I believe all you need is a "last" flag:

RedirectMatch permanent ^/forum/index.php$ http://www.mysite.com/forum/index.php [L]
RedirectMatch permanent ^/$ http://mysite.com/blog [L]

From our very own An Introduction to Redirecting URLs on an Apache Server [webmasterworld.com]:

The "L" flag tells apache that this is the last rule that it needs to process. It's not required in our simple example but, as your rules grow in complexity, it will become very useful. As your understanding of mod_rewrite deepens, you may add conditions to your rules (RewriteCond directive) and the "L" flag will tell apache that mod_rewrite can quit processing these conditions after performing the rewrite, IF the RewriteRule pattern is matched. Experts suggest that you get in the habit of including the "L" flag with every RewriteRule to avoid unpleasant surprises. As you gain experience, you may encounter situations where it's not needed. Experts assure me that these are very rare.