/    Sign up×
Community /Pin to ProfileBookmark

error 404 not quite working in htaccess

Hi,

I have a htaccess file and it is using this code

[CODE]
ErrorDocument 404 /websites/test.php
[/CODE]

Now if i type in the url below it works and directs to test.php:
[url]www.domain.com/something/some.htm[/url] (does not exist)

If however I miss the filename like so that does not.
[url]www.domain.com/something/[/url]

Any ideas?

Thanks
k0r54

to post a comment
Full-stack Developer

1 Comments(s)

Copy linkTweet thisAlerts:
@k0r54authorMay 28.2009 — Hi,

I have figured it out. Mod Rewrite is the function I wanted to use

[CODE]
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
# The path for localhost.
RewriteCond %{HTTP_HOST}/websites/example/index.php ^(1)27.0.0.1(/websites/example/index.php)$ [NC,OR]
# The path for example.com and www.example.com
#RewriteCond %{HTTP_HOST}/index.php ^(www.)?example.com(/index.php)$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule !^.+.(gif|jpe?g|png|css|js)$ %2 [QSA,L]
[/CODE]
×

Success!

Help @k0r54 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...