【发布时间】:2014-03-26 17:53:41
【问题描述】:
我有一个带有 html 页面和一个 .php 页面的网站。我正在尝试找出一种从地址栏中隐藏 .php 扩展名的方法。
我希望页面显示为 example.com/submit,而不是 example.com/submit.php
此外,使用下面的 .htaccess 文件,我似乎无法获得从 .html 版本页面重定向到 .php 页面的 google 站点链接。
这是我的 .htaccess 文件中的内容:
ErrorDocument 404 /page-not-found.html
ErrorDocument 403 /access-denied.html
SetEnv TZ America/Chicago
IndexIgnore *
Options +MultiViews
RewriteCond %{REQUEST_FILENAME} (.*)\.html [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %1\.php -f [NC]
RewriteRule ^(.*).html$ $1.php [NC]
我希望有人可以帮助我完成这项工作。
谢谢。
看来这个答案来自另一个特定于godaddy作品的线程。甚至不是接受的答案,而是附加评论。
Using .htaccess to make all .html pages to run as .php files?
Options +ExecCGI
AddType application/x-httpd-php .php .html
AddHandler x-httpd-php5 .php .html
【问题讨论】: