1

I have my index.php inside a subfolder which is inside another subfolder, etc. So, my hosting company doesn't let me modify the httpd-vhosts.config so the only way I have to indicate that I want to run my web from /subfolder1/subfolder2.... is the .htaccess.

I've searched a lot in stackoverflow, and all the stuff didn't work. Basically, I have these folders :

  • web
    • instances
      • myweb
        • public
          • root

Inside root, there is the index.php. So , when I enter at: www.mydomain.com.mialias.net, I want to go to index.php and run my website,

I've tried this :

RewriteEngine on
RewriteCond % ^midomain.com.mialias.net\.com$
RewriteRule (.*) http://www.midomain.com.mialias.net/$1 [R=301,L]
RewriteRule ^$ instances/myweb/public/root [L]

And it didn't work because the URL is like this : www.midomain.com.mialias.net/instances/myweb/public/root , which is wrong because I need to have my URL like : www.midomain.com.mialias.net/ in order to insert arguments on the URL, like : www.midomain.com.mialias.net/myaccount, and at the moment this is impossible because I have the URL as I said.

Does anyone know how to do it? Thank you very much!

Mark
  • 113
  • 7
  • Do you want to redirect all uris to your index.php? – Jeemusu Sep 20 '13 at 09:08
  • Duplicate? I think you might find your answer here: http://stackoverflow.com/questions/990392/htaccess-rewrite-to-redirect-root-url-to-subdirectory – Qben Sep 20 '13 at 09:33

1 Answers1

0

Try:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com\.mialias.net\.com$ [NC] 
RewriteCond %{REQUEST_URI} !^/instances/myweb/public/root
RewriteRule ^(.*)$ /instances/myweb/public/root/ [L]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220