Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 09-18-2009, 09:02 AM   #1 (permalink)
Junior Member
 
Join Date: 01-09-08
Location: UK
Posts: 8
iTrader: 0 / 0%
Spider-Man is liked by many
.htaccess for .co.uk domain with hyphens

Hi

I am trying to alter an .htaccess file for a script to run on my server.

My .htaccess is as follows, for domain www.my-domain-name.co.uk

Code:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^my-domain-name.co.uk [NC] RewriteRule ^(.*)$ http://www.my-domain-name.co.uk/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www.my-domain-name.co.uk [NC] RewriteRule ^(.*)$ http://www.my-domain-name.co.uk/$1 [R=301,L]
However, when I try to view the site in firefox, I get an error about the page not redirecting properly, so there must be an issue with the above htaccess rules - can anyone spot the problem?

Thanks for your help!
Spider-Man is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-18-2009, 10:13 AM   #2 (permalink)
Contributing Member
 
Jim Westergren's Avatar
 
Join Date: 12-28-05
Posts: 55
iTrader: 0 / 0%
Jim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of lightJim Westergren is a glorious beacon of light
Your code is very wrong ... it seems to me that your objective is to redirect to the www version, is that so?

Try this:

Code:
Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.|$) [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
__________________
Jim Westergren
JimWestergren.com | Follow me on Twitter
Jim Westergren is offline  
Add Post to del.icio.us
Reply With Quote
Old 10-06-2009, 03:53 AM   #3 (permalink)
Member
 
Join Date: 10-06-09
Posts: 30
iTrader: 2 / 100%
Latest Blog:
None

lanmonkey is liked by many
I use this:

Quote:
#301 reditect
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mysite\.co\.uk
RewriteRule ^(.*)$ http://mysite.co.uk/$1 [R=permanent,L]
I have used that successfully on hundreds of sites.
lanmonkey is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conflict, What is the right htaccess rule, default homepage file with htaccess? basketmen Coding Forum 2 01-20-2009 08:50 AM
2 hyphens ? Steve_gts Domain Name Forum 13 09-04-2006 02:59 AM
Domain names with 2 hyphens in a row Shannon SEO Forum 9 02-26-2005 12:06 PM
htaccess/mod rewrite help to redirect subdomain to a domain Thanol Coding Forum 0 07-19-2004 10:36 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 10:36 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.