Directing links from root to a directory.

New to mod_rewrite? This is a good place to start.

Directing links from root to a directory.

Postby Nervosa » Fri Jul 31, 2009 10:08 pm

I have a forum that's be installed in the root directory. I would like to move all the files to a new directory called /forums

I need a rule so when a user clicks on an old link they are directed to the new /forums location. Wither it be in the forums or a search engine.

thank you
Nervosa
 
Posts: 14
Joined: Mon Aug 18, 2008 3:04 pm

Postby richardk » Sat Aug 01, 2009 4:34 pm

Does the forum use mod_rewrite?
Will there be other/new files left in the document root?
Should the URL change to include /forums?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{DOCUMENT_ROOT}/forums%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/forums%{REQUEST_URI} -d
RewriteRule .* /forums%{REQUEST_URI} [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Nervosa » Sun Aug 02, 2009 11:19 am

Does the forum use mod_rewrite?
Yes

Will there be other/new files left in the document root?
Yes

Should the URL change to include /forums?
Yes
Nervosa
 
Posts: 14
Joined: Mon Aug 18, 2008 3:04 pm

Postby richardk » Sun Aug 02, 2009 1:00 pm

Post the forum mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

cron