Home > Backend Development > PHP Tutorial > apache url 重写的问题

apache url 重写的问题

WBOY
Release: 2016-06-06 20:49:40
Original
949 people have browsed it

想要重写所有的php页面为htm,用户可以通过.htm?key=val的方式访问,不能通过.php?key=val的方式访问,怎么弄?我动不动就设置成循环了,总是弄不好

回复内容:

想要重写所有的php页面为htm,用户可以通过.htm?key=val的方式访问,不能通过.php?key=val的方式访问,怎么弄?我动不动就设置成循环了,总是弄不好

<code><ifmodule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} test.htm [NC]
    RewriteRule ^test.htm$ test.php [QSA,PT,L]

</ifmodule>
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template