views:

31

answers:

1

Hello all,

I have a problem with getting my .htaccess to work like I want and I was wondering if anyone could shed a light on this.

Here is my current setup:

My shared hosting site can be accessed by http://www20.a2hosting.com/~myname/

I have several sub directories inside that I wish to access. For instance http://www20.a2hosting.com/~myname/subdir/public/index.php works just fine.

Now I'm trying to get all the calls to my subdir/public be re-directed to my index.php and to that extent I've created a .htaccess file in my subdir/public that looks as following:

RewriteEngine on 
RewriteRule ^.*$ index.php

However, when I direct my browser to http://www20.a2hosting.com/~myname/subdir/public/ I get the following 404 Error:

The requested URL /home/myname/public_html/subdir/public/index.php was not found on this server.

What am I doing wrong?

Thanks a lot!

+1  A: 

Try specifying an absolute path as the rewrite target:

  RewriteRule ^.*$ /index.php
Pekka
I just tried that and it ended up re-directing me to some default a2hosting.com page that informed me that the page I must have been trying to access was my cPanel and gave me a link to that. Very strange.
@user strange. Then try `/home/myname/public_html/index.php`
Pekka
@Pekka, I get the same index.php not found on this server 404 error.
@user sorry, then I don't know. But where is index.php? If it's in /myname, then you need to put it there.
Pekka
@Pekka, no worries thanks for trying. I have a ticket open with their support staff so hopefully they'll be able to tell me what's wrong