简体   繁体   中英

How to redirect the broken link to 404 page in htacces

Hi i want to redirect to 404 page through .htaccess file. My 404 file is under includes folder with the name of 404.php and .htaccess file is in root. This is the code i am writing in .htaccess file but nothing work yet.

#Turn On Rewrite Engine
RewriteEngine On
RewriteBase /

#Rewrite folder
RewriteRule ^llapp/(.*)$ adl1panel/$1 [L,QSA]

#Redirect to Home 

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule ^(.*)$ index.php/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule ^(.*)$ includes/404.php
ErrorDocument 404 /includes/404.php

Edit your .htaccess file with this line of code:

ErrorDocument 404 /404.php

That should do the trick. If on wordpress though

Redirect 301 /tags/something http://yoursite.com/404.php

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