Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. Share your own thoughts and experience, accounts may be terminated for violations.
  • Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

Urgent .htaccess help

Status
Not open for further replies.
Joined
Jan 5, 2012
Posts
1,070
Reaction score
32
Ok, at the moment my site is just http://mysite.co.uk, but i want it to be http://www.mysite.co.uk, tried doing this by changing the .htaccess file but it tries to go to www. - doesn't load though!

Here's what I have now:


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress




What should it be to get it working the way I want it?
 
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

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


So this should do it: EDIT - It doesn't, same problem. Tries to connect to www. but it doesn't.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mysite.co.uk
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 
Last edited:
Should there be a full stop here?

RewriteCond %{HTTP_HOST} !^www\.mysite.co.uk
 
This is what I have in my sites:
PHP:
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.co\.uk [NC]
RewriteRule ^(.*)$ http://www.yourdomain.co.uk/$1 [L,R=301]
Hope it helps!

Craig
 
Your original .htaccess is correct.

Wordpress will default to the way you have the url set up in the settings.

Goto General Settings and make sure you have "http://www." in Wordpress Address and Site Address.
 
Your original .htaccess is correct.

Wordpress will default to the way you have the url set up in the settings.

Goto General Settings and make sure you have "http://www." in Wordpress Address and Site Address.

I'm an idiot, lol. I read that somewhere but forgot about it, cheers!

Now I've just got to figure out how to change my sitemap, it still has http:// rather than http://www. , even uninstalled the plugin (google's XML sitemap or something) and reinstalled but it's still the same.
 
Status
Not open for further replies.
Top Bottom