views:

25

answers:

2

My host will not allow me to change the default folder of my primary domain. I have managed to Rewrite http://www.mysite.com to the real folder

public_html/mysite.com/www/

with the following code:

RewriteEngine On
RewriteRule ^$ /mysite.com/www/ [R=301,L]

This does successfully load my domain from the subfolder, but the url becomes:

http://mysite.com/mysite.com/www/

How can I continue loading requests from http://mysite.com/index.html in the correct folder shown above, without showing it in the client-side url?

+1  A: 

Try removing the R=301.

dreeves
+2  A: 

Try this one:

RewriteEngine On
RewriteRule ^mysite.com/www/(.*)  - [L]
RewriteRule ^(.*)$ mysite.com/www/$1 [L]

UPD:

The line with the dash is required because after the redirect at line 3 Apache reads the .htaccess once again to process the redirected URL. The rule prevents infinite loop.

newtover
Thank you, The suggestion from dreeves also worked but for some reason my images no longer worked. This solution worked perfectly :-)
pws5068
I'm glad to see the right solution to this. Could you explain what that dash is doing?
dreeves