简体   繁体   English

如何将断开的链接重定向到htacces中的404页面

[英]How to redirect the broken link to 404 page in htacces

Hi i want to redirect to 404 page through .htaccess file. 嗨,我想通过.htaccess文件重定向到404页面。 My 404 file is under includes folder with the name of 404.php and .htaccess file is in root. 我的404文件位于名为404.php的包含文件夹下,而.htaccess文件位于根目录中。 This is the code i am writing in .htaccess file but nothing work yet. 这是我在.htaccess文件中编写的代码,但尚无任何工作。

#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: 使用以下代码编辑.htaccess文件:

ErrorDocument 404 /404.php

That should do the trick. 这应该够了吧。 If on wordpress though 如果在wordpress上

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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