I changed .htaccess to this ErrorDocument 404 /index.php Now when I visit my domain, mydomain/test(test folder doesnt exist) then it redirects properly. But when I open mydomain.com/test/test, it does load the content but doesnt load other css file and images.
Please visit these links to understand the problem www.appsbuzzer.com/o and www.appsbuzzer.com/o/o
Any help is appreciable
in your html you include the css relative to the current folder
<link type="text/css" rel="stylesheet" href="css/style.css"/>
when visiting http://appsbuzzer.com/o/o the browser looks for http://appsbuzzer.com/o/css/style.css
change it to
<link type="text/css" rel="stylesheet" href="/css/style.css"/>
edit:
or add a base-tag
<base href="http://appsbuzzer.com/">
First of all it doesn't seem like the best idea to redirect 404s to your index.php (which I assume is your homepage). It'd be nice to inform the user that he has requested a page that doesn't exist (probably because it was removed but still linked somewhere).
Your missing css/image files in subdirectories have to do with how the browser is looking for them. If you have an image included like this:
<img src="images/boobs.gif" alt="Soooo nice">
the browser will request it from the directory images relative to where it assumes it is now.
/ => /images/boobs.gif
/test => /images/boobs.gif
/test/ => /test/images/boobs.gif
/test/test/foo.html => /test/test/images/boobs.gif
As soon as there's a / somewhere in the path (except for the first char) it indicates to the browser that it's looking at a subdirectory and searches files relatives to that.
To avoid this you need to use absolute paths. Either by giving the full URL
<img src="http://example.com/images/boobs.gif" alt="Soooo nice">
Or by simply prepending the local path with a /.
<img src="/images/boobs.gif" alt="Soooo nice">
Which tells the browser to always start looking from the root directory.
As noted above will work too and is probably the easiest way out since it basically prepends the value to all relative paths in all kinds of tags which can contain them (a, img, link, iframe, ...).