Forum Moderators: phranque

Message Too Old, No Replies

Forwarding / to /index.php with 301 redirect

Without causing it to loop

         

wfernley

9:32 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My forums homepage is duped. Both the /forums/ is indexed and /forums/index.php. How would I go about creating a redirect without it causing a loop. I tried a basic redirect which didn't work.

RewriteRule ^/ index\.php [L,R=301]

I'm sure thats probably not the correct syntax which is why it is looping. Can anyone help?

Thanks in advance for your help!

Wes

jdMorgan

9:44 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should consider going the other way, since it's far easier for someone to type-in your URL without the unnecessary /index.whatever on it, and it looks better and more professional in search results as well.

Will your site be ".php" forever? Maybe not, so why build-in a latent problem for tomorrow?

See this post [webmasterworld.com] from earlier today for a code example.

You can fix the code you've got if you choose the other way.

In /forums/.htaccess :


RewriteRule ^$ /index\.php [L,R=301]

If that still loops, use the technique shown in the cited thread.

Jim

wfernley

2:09 pm on Jan 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jim.

The reason I wanted to keep the .php was due to the fact that it is a PHPBB forums and all links in the forums go to index.php instead of /. You are right about it being cleaner and better for search engines. I guess I will change the .htaccess to go to just / and go through the entire forums and update each page to link to the correct location.