Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a hosted account not linked to any domain at /~me.

In the top level of my home directory I have a .htaccess file:

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteRule 123.html cgi-bin/example.php [nc]

The full path of example.php is /~me/public_html/cgi-bin/example.php. However /~me/123.html returns a 404.

Is my .htaccess not valid?

share|improve this question
1  
/~me/public_html/cgi-bin/example.php contains the above file - what do you mean? Where's the .htaccess file located? –  Shane Madden Nov 30 '12 at 5:02
    
"in the top level of my home directory" - /~me. The full path of file cgi-bin/example.php is at /~me/public_html/cgi-bin/example.php. –  user1561108 Nov 30 '12 at 10:37
    
Which directory is your document root - ~me or ~me/public_html? –  Shane Madden Nov 30 '12 at 16:31
    
/~me but it's a pretty standard hosting idea that web requests get redirected to public_html. The .htaccess file in ~me should still work. That's how it works in my other host provider for example. –  user1561108 Nov 30 '12 at 16:55
    
Well, if you put a test.html file in ~me, not in public_html, does it work? –  Shane Madden Nov 30 '12 at 17:00

1 Answer 1

The issue was the shared hosts Apache mod_rewrite config that identifies which script to run by the host. I wasn't using a hostname initially, just raw IP, so the server didn't which user account directory to find the target script in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.