Rewrite URL after redirecting 404 error htaccess

前端 未结 4 1131
南旧
南旧 2020-11-27 12:36

So I know this may seem a little strange but I for sake of consistency, I would like all my urls to appear in this form: http://domain.com/page/ So far I have gotten the reg

4条回答
  •  日久生厌
    2020-11-27 12:59

    Try adding this rule to the top of your htaccess:

    RewriteEngine On
    RewriteRule ^404/?$ /pages/errors/404.php [L]
    

    Then under that (or any other rules that you have):

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^ http://domain.com/404/ [L,R]
    

提交回复
热议问题