我创建了一个php网站。这里我已经在.htaccess文件中实现了干净的URL。我需要显示的链接万亩 mydomain/index.php
到mydomain/index
只在我的网站上将所有页面重写为页面名称
所以我用
RewriteRule index index.php
但我有很多文件。那么,我将如何为整个页面编写一条通用规则?
E:摹
RewriteRule hotels hotels.php
感谢
我创建了一个php网站。这里我已经在.htaccess文件中实现了干净的URL。我需要显示的链接万亩 mydomain/index.php
到mydomain/index
只在我的网站上将所有页面重写为页面名称
所以我用
RewriteRule index index.php
但我有很多文件。那么,我将如何为整个页面编写一条通用规则?
E:摹
RewriteRule hotels hotels.php
感谢
试试这个:
#Setup
Options +FollowSymLinks
RewriteEngine On
#Remove trailing slashes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=permanent,QSA]
#Your thing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
这很聪明:'RewriteCond%{REQUEST_FILENAME} .php -f' – 2012-04-18 11:12:37
@j_melis,http://imgon.net/di-V92O.png – Adi 2012-04-18 13:23:38
搜索了一下,你会发现数千个号码完全相同的:-) – undone 2012-04-18 11:01:45
的http:// wettone.com/code/clean-urls – Jared 2012-04-18 11:05:11