The method in Apache that makes non pseudo static url jump to pseudo static url

  • 2020-05-14 05:24:20
  • OfStack

How do I use.htaccess to make a non-pseudo-static page 301 jump to a pseudo-static page and then jump again? This is a very painful jump. The page cannot be opened because it will become an endless loop if you are not careful. Fortunately, the problem was finally solved. Take notes and share them with friends in need.

The rules are as follows:


RewriteRule ^article-([0-9]+).html$ /article.php?id=$1&r=1 [L]

RewriteCond %{QUERY_STRING} ^id=([0-9]+)$ [NC]

RewriteRule ^article.php$ /articlel-%1.html? [L,R=301]

Note:

Create.htaccess file,Windows is not allowed to name the file as., we can use UE/EditPlus and other tools to save as.htaccess to achieve.
After creating, modify.htaccess file content for your program corresponding pseudo-static rules, uploaded to the program file directory can be realized


Related articles: