Page 1 of 1

.htaccess finding file

Posted: Sat Aug 22, 2009 12:07 pm
by JustinMs66
right now i am using http://ip.goes.here/~admin/ to view my website until i switch dns over this new server. http://ip.goes.here/~admin/ points to /home/admin/public_html/.

I have an .htaccess in /home/admin/public_html/ saying:

Code: Select all

RewriteEngine On
allow from all
RewriteRule ^contact$ contact.php
when i go to http://ip.goes.here/~admin/contact.php, it works, but when i go to http://ip.goes.here/~admin/contact, it says:
404: The requested URL /home/admin/public_html/contact.php was not found on this server.
however, i checked it with SSH, and that file does exist.

so .htaccess is looking in the wrong place. is this because of the extra directory /~admin/ in the url i have to use until i switch, is it screwing things up?

Re: .htaccess finding file

Posted: Sat Aug 22, 2009 2:43 pm
by Darhazer
This can be resolved in this way:

Code: Select all

RewriteCond %{REQUEST_URI} ^(.*)/contact$
RewriteRule ^contact$ %1/contact.php