从url中删除.php,但有例外(htaccess)
我有以下.htaccess文件:从url中删除.php,但有例外(htaccess),php,mysql,.htaccess,url,url-redirection,Php,Mysql,.htaccess,Url,Url Redirection,我有以下.htaccess文件: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ account.php?username=$1 这基本上是为我的用户配置文件服务的,所以像twitter一样,有人可以键入:url.com/theirusername 但是,我想让某些页面,如/home,不会导致一个概要文件,而是一个不同的.php页面,最后也没有.php 有人能想出一个办法吗 谢谢 在此规则之前,您可以添加另一个规则。php: 只需添加更多规则以
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ account.php?username=$1
这基本上是为我的用户配置文件服务的,所以像twitter一样,有人可以键入:url.com/theirusername
但是,我想让某些页面,如/home,不会导致一个概要文件,而是一个不同的.php页面,最后也没有.php
有人能想出一个办法吗
谢谢 在此规则之前,您可以添加另一个规则。php:
只需添加更多规则以匹配所有其他页面,将其放在用户名规则之前
RewriteEngine On
RewriteRule ^home$ home.php
RewriteRule ^contact$ contact.php
RewriteRule ^([a-zA-Z0-9_-]+)$ account.php?username=$1
感谢您抽出时间回答。我最后使用了第一个答案。
RewriteEngine On
RewriteRule ^home$ home.php
RewriteRule ^contact$ contact.php
RewriteRule ^([a-zA-Z0-9_-]+)$ account.php?username=$1