求一伪静态的写法,该怎么处理
求一伪静态的写法
现在我有一个要求,动态的php文件地址映射成为后缀的静态地址。
但是现在出现了原来的静态的htm文件却找不到了!
我的静态规则如下:
ReWriteEngine on
ReWriteRule (.*).htm $1.php
哪位大哥找我修改一下。
------解决方案--------------------
AddType application/x-httpd-php .htm
------解决方案--------------------
恩。你的静态规则存在冲突。估计不好实现。
真正的静态文件和纯php文件应该有区别的。就像一个文件夹里不能有两个同名的文件。
可以这样
纯静态文件的用html。php的用htm。
------解决方案--------------------
------解决方案--------------------
是不是你的项目入口有多个啊,现在的web项目一般入口都只有一个:如:index.php,对于这样的访问方式做url重写都好处理,若你的入口多了,处理起来就有点麻烦
------解决方案--------------------
自己总结一下规律,哪些.htm不要转,
然后就知道怎么写了
------解决方案--------------------
另外, 试下这个
存在就不转,不存在的就转
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
ReWriteRule (.*).htm $1.php
------解决方案--------------------
ReWriteEngine on
ReWriteRule (.*).php $1.htm
楼主写反了吧

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c
