This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: redirect from domain only to a path
Author
Message |
yonihbc
Newbie


Joined: 29 July 2011
Posts: 12
Posted: 20 September 2011 at 11:38am

i'm trying a simple thing but don't know how

i need http(s)://www.domain.com

to redirect (moved permenently) to http(s)://www.domain.com/folder/file.ext

what is the best way?

i already have non-www to www and non https to https

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 20 September 2011 at 8:32pm

All you need now is to add the following rule:

RewriteBase /
RewriteRule ^$ /folder/file.ext [NC,R=301,L]

Regards
Andrew
Back to Top
 
yonihbc
Newbie


Joined: 29 July 2011
Posts: 12
Posted: 20 September 2011 at 10:51pm

It is not working

RewriteEngine On
RewriteBase /
RewriteRule ^$ /folder/file.ext [NC,R=301,L]

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

#redirect from http to https
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? https://%1%2 [R=301]

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 21 September 2011 at 4:28am

Please, provide the rewrite.log for the testing request.
Logging issues described in FAQ

Regards
Andrew
Back to Top
 
yonihbc
Newbie


Joined: 29 July 2011
Posts: 12
Posted: 21 September 2011 at 10:36pm

Never mind - i managed to fix the problem

another question though that relate to the first one with the domain to a specific path

if i need to do the same but:
from http://sub.domain.com to http://sub.domain.com/folder/file.ext???

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 September 2011 at 5:31am

Please, try using the following:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:Host} ^sub\.domain\.com$
RewriteRule ^$ /folder/file.ext [NC,L]

Regards
Andrew
Back to Top
 

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

Printable version Printable version