htaccess problem

I have tested the following htaccess file and it works fine, all 404 pages are redirected to the home page as expected

RewriteEngine On ErrorDocument 404 http://mydomain.com/

However, the following htaccess file doesn’t work (404 pages are no longer redirected to the home page, it just appears as the default 404 page of the server)

DirectorySlash Off

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !/routed.php$
RewriteCond %{REQUEST_FILENAME} !.\S+$ [OR]
RewriteCond %{REQUEST_FILENAME} .(htm|shtml|html|php|php4|php5)+$
RewriteRule ^(.*)$ routed.php?$1 [QSA,L]

ErrorDocument 404 http://mydomain.com/

I have tried moving the line “ErrorDocument 404 http://mydomain.com/” to the top, but no luck.

Could anyone kindly help me about what would be wrong?

Thanks!

hi quacky,

well I suggest you to read about htaccess on docs from apache. Its all there… just read it. Also this have nothing to do with virtualmin nor webmin. If you need pro help feel free to hire some pro like me or other devops here around.

Have nice day.

Ya, initially i thought that was the problem with virtualmin, since the same code works on cpanel, but i have just realized that a function which take care of 404 page inside the file routed.php has been changed, and it just echo 404 error exactly like the default 404 error of the server.

Sorry about that. I will mark it as resolved now.

Sorry, i can’t find the “Mark as resolved” button anywhere

just edit the topic and put on front something like resolved or [resolved]…

Im glad you found your way to make ti working :slight_smile: