This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: .htaccess for non-www to www (Topic Closed Topic Closed)
Author
Message |
webdevsp
Newbie


Joined: 04 December 2008
Location: United Kingdom
Posts: 10
Posted: 23 October 2009 at 8:22pm  

Hi

Our hosts server has ISAPI_Rewrite v3 installed. 

Our site  (www.silverhouse   property.com) has cannonisation issues)

I'm new to this but understand I need to put a .htaccess file in place - there is not one there at the moment.

Would be much obliged if anyone advise on lines required in file?

Also any other tips ...maybe directing www.domain.com/index.php to www.domain.com       would be needed?

Many Thanks!


__________________
Andy - Webdev
Back to Top Visit webdevsp's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 26 October 2009 at 5:15am  

"Would be much obliged if anyone advise on lines required in file?" - could you please specify what you want to achieve using ISAPI_Rewrite.

"directing www.domain.com/index.php to www.domain.com":

RewriteBase /
RewriteRule ^index\.php$ / [NC,R=301,L]

__________________
Regards,
Anton
Back to Top
 
webdevsp
Newbie


Joined: 04 December 2008
Location: United Kingdom
Posts: 10
Posted: 26 October 2009 at 6:45am  

Hi  Yes sorry I wanted to do 2 things:-


1. Direct any requests for http://domain.com to http://www.domain.com

2. direct any requests for www.domain.com/index.php to www.domain.com



__________________
Andy - Webdev
Back to Top Visit webdevsp's Homepage
 
webdevsp
Newbie


Joined: 04 December 2008
Location: United Kingdom
Posts: 10
Posted: 26 October 2009 at 7:35am  

This is the current contents of .htaccess

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.silverhou seproperty.com/$1 [R=301,L]

RewriteBase /
RewriteRule ^index\.php$ / [NC,R=301,L]



__________________
Andy - Webdev
Back to Top Visit webdevsp's Homepage
 
webdevsp
Newbie


Joined: 04 December 2008
Location: United Kingdom
Posts: 10
Posted: 26 October 2009 at 8:17am  

I've now got....

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.silverh ouseproperty.com/$1 [R=301,L]

RewriteBase /
RewriteRule ^index\.php$ / [NC,R=301,L]


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


Think I have some redundent lines but it seems to be working!


__________________
Andy - Webdev
Back to Top Visit webdevsp's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 26 October 2009 at 8:21am  

Please try to use the following config:

RewriteBase /

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

RewriteRule ^index\.php$ / [NC,R=301,L]

__________________
Regards,
Anton
Back to Top
 
webdevsp
Newbie


Joined: 04 December 2008
Location: United Kingdom
Posts: 10
Posted: 26 October 2009 at 6:57pm  

Hi Anton

I tried what you advised & it all stopped working...expect I was meant to replace some variable with the real domain name?

I put it back to as below and working again...but expect this is an inefficient way to do it?  Thanks

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.silverh ouseproperty.com/$1 [R=301,L]

RewriteBase /
RewriteRule ^index\.php$ / [NC,R=301,L]


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



__________________
Andy - Webdev
Back to Top Visit webdevsp's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 27 October 2009 at 6:02am  

Could you please explain what should be in the host section of the URL instead of space?

And please try the following config:

RewriteBase /

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

RewriteRule ^index\.php$ / [NC,R=301,L]

RewriteRule ^(.*)index\.php$ http://www.silverh ouseproperty.com/$1 [NC,R=301,L]



__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum