Sunday, 15 March 2015

.htaccess - how to redirect to my custom 404 error page if subdirectory not present -



.htaccess - how to redirect to my custom 404 error page if subdirectory not present -

i have joomla site , have custom 404 error page. works correctly if there no file present. ex: my-domain.com/aaa shows custom 404 page correctly url: my-domain.com/error-404.html

but when sub-directory not nowadays (ex: my-domain.com/aaa/) not shows url changes my-domain.com/aaa/error-404.html

i want redirect 404 error page if sub-directory name typed not present.

this in joomla 2.5

create custom '404' article

create new unpublished menu item links custom 404 article , apply changes. re-create url page (index.php?optio...)

in joomla installation, re-create error.php file templates/system directory template directory.

edit error.php file (which copied template directory) , add together next code under 'restricted access' line:

if (($this->error->getcode()) == '404') { header('location: /index.php?option=com_content&view=article&id=...'); exit; }

good luck!

.htaccess joomla2.5

No comments:

Post a Comment