5 Tips on Creating Redirects in .htaccess
·350 字·2 分鐘
Per-directory rewrites need rewriting within <Directory> sections or .htaccess files, which introduces some complexity. However, if you only have permission to modify files, you must know how to put redirects in .htaccess files with RewriteRule.
1RewriteEngine on 2RewriteRule ^/index\.html$ /index.php [L] A RewriteRule consists of three arguments separated by spaces.
The arguments are
Pattern: which incoming URLs should be affected by the rule, ex ^/index\.html$; Substitution: where should the matching requests be sent, ex /index.php; [flags]: options affecting the rewritten request, ex [L]. Here are 5 tips for creating redirects in .htaccess files.