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

apache url 重写的问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:49:40
Original
981 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
Latest Issues
Apache automatically stops
From 1970-01-01 08:00:00
0
0
0
apache restart failed
From 1970-01-01 08:00:00
0
0
0
apache error
From 1970-01-01 08:00:00
0
0
0
How apache logs
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template