PDA

View Full Version : Redirecting from domain.com to the www version


alexandru
09-05-2007, 09:50 PM
Hi guys. I've tried searching through the forums, but maybe I'm not using the right query.

My situation is the following ...

I got a WordPress install at domain.com and the forums at domain.com/forums. WordPress redirects himself just fine from domain.com to www.domain.com, but obviously it doesn't work for the forums.

Now, the forums directory has a .htaccess file that handles the url rewrite. This is how it looks like:


Options +FollowSymlinks
RewriteEngine on

RewriteRule ^([a-z0-9_\-]*-(f|all)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ forumdisplay.php/$1 [QSA,L]
RewriteRule ^([a-z0-9_\-]*-(t|p)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$ showthread.php/$1 [QSA,L]
RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]
RewriteRule ^(archive|sitemap)/(.*)$ $1/index.php/$2 [QSA,L]

And I tried adding this bit below to make sure it redirects to www. It didn't work. Also tried making a second htaccess file for the domain.com instead of the forums directory, but it doesn't redirect the forums directory (maybe it interferes with the htaccess from that folder?).

rewritecond %{http_host} ^imperialages.com [nc]
rewriterule ^(.*)$ http://www.imperialages.com/$1 [r=301,nc]

Sorry if I didn't explained well. I'm not really that technical.

Is there any plugin that would do this redirect? Or does anyone know what to add to the htaccess file to make it work?