简体   繁体   中英

.htaccess 404 pages not showing

I have one website, for that only error page is displaying for the main url. eg: 404 error page is displayed in www.example.com/123 .

When I go any other pages eg: www.example.com/about.php/123 , the error page is not displayed. Only the same page without style sheet is displayed.

Here's my htaccess code:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f``
RewriteCond %{REQUEST_FILENAME} !-d
ErrorDocument 404  http://www.example.com/404.php

Please help me to redirect to 404 pages when someone type wrong urls for the pages with the php extension (eg: index.php , about.php , contact.php etc)

You try this code as per your page name and need some changes in " .htaccess " file.

**RewriteRule ^([a-zA-Z_-]+)$ index.php?action=$1 
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)$ index.php?action=$1&mode=$2
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)$ index.php?action=$1&mode=$2&id=$3**

I hope solve the your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM