我需要隐藏我的网页的扩展名,也想让用户把链接都放在(小写和大写):
示例:
文件名为demo.php
www.example.com/demo www.example.com/DEMO www.example.com/Demo
在LAMP服务器上运行PHP,不能访问php.ini,只能访问.htaccess
实际上,我使用的文件是这样的:
RewriteEngine On
RewriteBase /
RewriteRule ^/(OUTSOURCING|outsourcing|Outsourcing)$ outsourcing.php [NC,L]我收到了这个错误:
Not Found
The requested URL /outsourcing was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.发布于 2011-05-24 12:28:26
RewriteEngine On
RewriteBase /www.example.com/DEMO www.example.com/Demo或www.example.com/DEMO/page2
RewriteRule ^/(DEMO|demo|Demo)/(.*)$ demo.php?=$1 [NC,L]
RewriteRule ^/(DEMO|demo|Demo)$ demo.php [NC,L]
RewriteRule ^/(D|d)emo$ demo.php [NC,L]或者将任何www.example.com/DeMo www.example.com/bob传递给demo.php
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ demo.php [NC,L]您可能需要测试您允许的.htaccess RewriteRule /*$ http://google.com [R][L]
发布于 2011-05-24 12:47:48
下面是一个使用不区分大小写的方法的好方法
编辑:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ${lc:$1}.php [NC]这样,输入的任何内容都会被重定向到一个php文件。
编辑:这样你的js和css文件仍然可以运行。
发布于 2011-05-24 12:40:42
RewriteRule ^/[Dd][Ee][Mm][Oo]/?(.*)$ demo.php [NC,L]会将"Demo“的任何大小写重定向到demo.php
https://stackoverflow.com/questions/6105667
复制相似问题