Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorThaLyric
    • CommentTimeSep 7th 2006
     permalink
    Hi,

    I've got a strange problem.

    I've created a .htaccess to handle error documents :

    [code]
    ErrorDocument 404 http://www.mydomain.nl/index.php
    ErrorDocument 403 http://www.mydomain.nl/index.php
    [/code]

    This works fine. But when I tye to access a .php file that doesn't exists (for example http://www.mydomain.nl/hahahahahahaha.php) I get the error :

    [code]
    No input file specified.
    [/code]

    The website is hosted on a shared hosting, so I can't modify for example php.ini.

    So after some research I came up with :

    [code]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ http://www.mydomain.nl/index.php
    [/code]

    So now when I access http://www.mydomain.nl/hahahahahahaha.php it redirects me to index.php ... that's good ... but wait ... why did I post here?

    I've also got folder for example /forum/ (http://www.mydomain.nl/forum/). When I try that it redirects me to index.php. That was not supposed to happen.

    Ho can help me on this? I only want a redirect when a .php file is served that isn't on the server.
  1.  permalink
    Try this:


    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]

    ErrorDocument 404 http://www.mydomain.nl/index.php
    ErrorDocument 403 http://www.mydomain.nl/index.php
Add your comments
    Username Password
  • Format comments as (Help)