【发布时间】:2012-03-30 10:46:50
【问题描述】:
如何通过 index.php 重新路由对 php 页面的所有请求?
我的.htaccess如下:
Options +FollowSymLinks
IndexIgnore */*
#Turn on the RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !.*\.(js|ico|gif|jpg|png|css|pdf)$ index.php%{REQUEST_URI} [L]
基本上,我正在尝试模拟 .NET 母版页。 index.php 有网站页眉/页脚。
它将 404 重定向到 index.php。如何让它将所有请求重定向到 php 页面(index.php 本身除外)?
此方法是否存在性能问题(不想使用框架)?
【问题讨论】:
-
在 Mod-Rewrite 上:stackoverflow.com/questions/8440490/… - 在性能上:stackoverflow.com/questions/8145128/…