htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: moving to a subfolder without moving homepage
PostPosted: 15 May 2008 18:53 
Offline

Joined: 15 May 2008 18:46
Posts: 1
Hi

i have a forum with several thousand indexed pages which ranks quite well.

i now have the need to move this to domain.com/forum as i want to expand the main domain to be more than just a forum.

i know how to do a 301 for the entire site but i dont want to redirect domain.com to domain.com/forum

so basicaly the index page needs to remian where it is but every other existing page needs to be 301 redirected to /forum

and i dont really want to write them out manuall :-) plz hlp

I look forward to your replies

Thanks

T


Top
 Profile  
 
 Post subject: Re: moving to a subfolder without moving homepage
PostPosted: 11 Jul 2008 04:47 
Offline

Joined: 30 Oct 2006 19:55
Posts: 99
What code are you using to redirect everything else?

You can try this code:

Code:
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\ HTTP/
RewriteRule .* - [L,S=1]

RewriteCond %{THE_REQUEST} !^[A-Z]{3,9}\ /forum(.*)\ HTTP/ [NC]
RewriteRule .* http://www.site.com/forum%1 [R=301,L]


This says if the requested url is your root index "/" then do nothing and skip the next rewriterule block. For all urls other than "/" they will be redirected. Nice huh? :)


Top
 Profile  
 
 Post subject: Re: moving to a subfolder without moving homepage
PostPosted: 11 Jul 2008 04:48 
Offline

Joined: 30 Oct 2006 19:55
Posts: 99
I took the answer from the article Rewriting blog index.php to root


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB