我想创建一个使用PHP的网站,但不希望显示http://example.com/index.php
这样的扩展程序,我有index.php
个文件,但只想显示index.html
,可能是.html
别的东西..
我不知道该怎么做,请帮帮我。
答案 0 :(得分:2)
您可以在站点根目录中使用这两个规则.htaccess:
<div class="dp-tab-1">
<ul class="dp-tab-list row" id="myTab">
<% if @project.package.has_background_ip == true %>
<li class="col-md-2 col-xs-6 <%= 'active' if firstActiveTab == 1 %>" >
<!-- <li class="col-md-2 col-xs-6 active" > -->
<a href="#tab-content-first">
<span class="glyph-item" data-icon=""></span>
<span>BACKGROUND INTELLECTUAL PROPERTY</span>
</a>
</li>
<% end %>
<% if @project.package.has_data == true %>
<li class="col-md-2 col-xs-6 <%= 'active' if firstActiveTab == 2 %>" >
<!-- <li class="col-md-2 col-xs-6"> -->
<a href="#tab-content-second">
<div class="glyph-item" data-icon=""></div>
<span>DATA</span>
</a>
</li>
<% end %>
<% if @project.package.has_funding == true %>
<li class="col-md-2 col-xs-6 <%= 'active' if firstActiveTab == 3 %>" >
<!-- <li class="col-md-2 col-xs-6"> -->
<a href="#tab-content-third">
<div class="glyph-item" data-icon=""></div>
<span>FUNDING</span>
</a>
</li>
<% end %>
<% if @project.package.has_materials == true %>
<li class="col-md-2 col-xs-6 <%= 'active' if firstActiveTab == 4 %>" >
<!-- <li class="col-md-2 col-xs-6"> -->
<a href="#tab-content-fourth">
<div class="glyph-item" data-icon=""></div>
<span>MATERIALS</span>
</a>
</li>
<% end %>
答案 1 :(得分:1)
.htaccess有一个非常简单的方法:
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} (.*)\.php
RewriteRule ^(.*)\.php $1.html [R=301,L]