Student Loans and Credit - Mortgage Calculator - Home Insurance - Loans - Loans

PDA

View Full Version : Need help with .htaccess file (www. redirection)


projectwealth
Jan 9th 2008, 4:31 am
Hello there,

I'm going completely insane with a new website of mine at the moment.:confused:

I'm hosting with hostgator.com and they use an apache server. The problem is when I type my website name into the browser http://www.richandjobless.com for some reason it redirects to http://richandjobless.com

For branding reasons I want to keep the www.

The default .htaccess file reads as follows:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I've tried to edit the .htaccess file to redirect to www. by adding the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^richandjobless.com
RewriteRule (.*) http://www.richandjobless.com/$1 [R=301,L]

but it redirects back to www. then the non-www address in an infinite loop so it doesn't help much at all.:rolleyes:

Does any one have any ideas why this is happening and what I can do to fix it?

FYI... I don't know if this helps but the contents of the index.php file that the .htaccess file refers to is as follows:

<?php
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
?>

Any and all suggestions would be GREATLY appreciated.

Thanks very much,

Dave

jmf000
Jan 9th 2008, 8:09 am
The problem cant be solved via modding .htaccess.
Your pages generated by php return redirect code.
You have to dig wp-blog-header.php and find line like (may be after check for www prefix)

header('Location: ....');

It causes redirection.

Jean-Luc
Jan 9th 2008, 10:28 am
Check your WordPress admin panel. Go to "Options", then "General" and look at : WordPress address (URL) and Blog address (URL). I suspect that the problem is in one of these parameters.

Jean-Luc

projectwealth
Jan 9th 2008, 8:19 pm
JEAN LUC!!!!!!!!!!!!!!!!! BUDDY!!!!!!!!! DO YOU KNOW HOW MUCH I LOVE YOU!!! :)

That worked a treat! I'm not familiar with wordpress settings at all and just presumed it was the .htaccess file!

YOU ARE A LEGEND MY FRIEND!

Thanks again,

Dave


PS:Thanks for your suggestion too jmf000!