404 pages for joomla subfolders - Joomla! Forum - community, help and support


i wanted protect or restrict access joomla subfolders such images, libraries, includes, language, administrator , many others when type
http://yoursite.com/images see 404 custom error page.

anyone can teach how this?

i have seen in website http://rappler.com , when type http://rappler.com/images can see 404 error page. , looks nice! :)

please teach how accomplish this... :)

you "should" seeing blank page if go http://www.yoursite.com/images there should blank index.html file there. index.html file in place stops browser showing directory listings specific folder. in other words, if remove index.html file , visit same url see page starting "index of..." , show contents of folder (i.e. images). joomla package comes index.html in folders (images, language, modules, plugins, components, etc.)

so if wanted style these pages have options. i'll list work not desirable , give reason. could:

option 1.) create own index.html file contents want , overwrite index.html files in of folders on server wanted index.html file appear. battle update joomla files overwritten resulting in custom page being lost way not desirable.

option 2.) add meta refresh tag each of index.html files wanted redirect single page created. result in having 1 page (instead of several custom index.html files example above desired index.html files point to. however, example above files overwritten joomla update way not desirable.

option 3.) add code .htaccess file redirect desired index.html files single page. create single page , name whatever want. in example name your_custom_page.html. upload server in root directory. open joomla .htaccess file , add in lines of rewriterule code in section shown below:

code: select all

## begin - custom redirects
#
# if need redirect pages, or set canonical non-www to
# www redirect (or vice versa), place code here. ensure those
# redirects use correct rewriterule syntax , [r=301,l] flags.
#
rewriterule ^images/index.html$ your_custom_page.html? [nc,l]
rewriterule ^includes/index.html$ your_custom_page.html? [nc,l]
## end - custom redirects

result = navigating http://www.yoursite.com/images or http://www.yoursite.com/includes shows contents of your_custom_page.html. i've tested on localhost. no index.html files overwritten lines of code added htaccess no worries of losing changes when updating in future.

note: not guru when comes htaccess coding if has better code or better way accomplish perhaps provide input. always make sure file/code before editing it.

mark





Comments