htaccess problem

5 posts / 0 new
Last post
#1 Thu, 03/16/2017 - 07:52
quacky

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
<IfModule mod_rewrite.c>
   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]
</IfModule>

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!

Thu, 03/16/2017 - 07:57
unborn
unborn's picture

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.

Configuring/troubleshooting Debian servers is always great fun

Thu, 03/16/2017 - 08:14
quacky

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.

Thu, 03/16/2017 - 08:15
quacky

Sorry, i can't find the "Mark as resolved" button anywhere

Fri, 03/17/2017 - 08:40 (Reply to #4)
unborn
unborn's picture

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

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

Configuring/troubleshooting Debian servers is always great fun

Topic locked