Dynamic rewrites in htaccess file

后端 未结 1 675
刺人心
刺人心 2021-01-28 07:14

I am working on some rewrites and redirects in my htaccess file. My reason for doing this is because I am developing a new design and layout for an existing website therefore I

1条回答
  •  生来不讨喜
    2021-01-28 07:35

    Yes, it's definitely a good idea to do all redirection stuff in php. Just have a simple "catch-all" .htaccess

    RewriteCond  %{REQUEST_FILENAME} !-f
    RewriteCond  %{REQUEST_FILENAME} !-d
    RewriteRule  .* index.php
    

    then transform urls as you want in php and send a location header when necessary. It might be a good idea to add 301 status code for "old" urls.

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