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?

  • 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

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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