.htaccess redirect to 404 page RewriteRule

后端 未结 2 1404
梦毁少年i
梦毁少年i 2020-12-14 01:18

Is there a way to enter a RewriteRule in the htaccess file to redirect to a 404 page if a certain folder/url path as been typed or reached?

For example, if I want ev

相关标签:
2条回答
  • 2020-12-14 01:32

    Instead of using mod_rewrite, you can do this with a RedirectMatch directive:

    RedirectMatch 404 ^/abc/.*$
    
    0 讨论(0)
  • 2020-12-14 01:35

    I did this on my website:

    RewriteRule ^404/?$ 404.php
    ErrorDocument 404 http://www.example.com/404/
    

    And on the root of my website I placed a 404.php page to customize that page.

    0 讨论(0)
提交回复
热议问题