我在该网站上工作的是www.pinkdropwellness.com。
目前我正在尝试从我网站的网址中删除.php扩展程序。
无论我尝试哪些代码,它都无法在我的网站上运行。当我从链接的href中删除.php时,它将始终将我发送到找不到的页面。
这是我当前的.htaccess文件:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9-_]+)/? /$1.php
RewriteRule ^([a-z0-9-_]+).php$ /$1/ [R]
我尝试了各种不同的推荐代码,无论我尝试什么,我都会被重定向到/ public_html / link,或者/ link都是错误页面。即使我将link.php作为href,它也会显示为错误页面。我觉得我在这里错过了一些简单的东西!
编辑:
这是我的index.php代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Pink Drop Wellness Homepage">
<meta name="keywords" content="Pink,Drop,Wellness,Fertility,Awareness,Essential,Oils,Blog">
<meta name="author" content="Lucy Bowe">
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
<img id="logo" src="/images/PinkDrop.png" alt="Pink Drop Wellness">
<img id="tree" src="/images/Tree.png" alt="Tree" usemap="#links">
<map name="links">
<area
shape="poly"
name="blog"
coords="445,105,432,123,418,132,402,132,386,136,385,156,417,168,437,185,475,208,510,197,531,167,527,141,496,106"
href="/blog"
alt="Blog"
/>
<area
shape="poly"
name="fertilityawareness"
coords="138,450,149,443,167,441,186,441,199,447,208,458,228,466,243,477,256,477,270,483,302,480,325,475,349,472,371,457,383,443,391,427,373,398,345,373,310,347,268,334,218,348,194,377,141,436,169"
href="/fertilityawareness"
alt="Fertility Awareness"
/>
<area
shape="poly"
name="essentialoils"
coords="787,490,753,498,719,523,671,553,634,566,593,541,545,487,540,432,570,407,606,403,653,420"
href="/essentialoils"
alt="Essential Oils"
/>
</map>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="/scripts/jquery.imagemapster.js"></script>
<script>
var image = $('#tree');
image.mapster({
mapKey: 'name',
listKey: 'name',
clickNavigate: true,
isSelectable: false,
areas: [
{
key: "blog",
fillColor: "5679c7",
},
{
key: "essentialoils",
fillColor: "638a69",
},
{
key: "fertilityawareness",
fillColor: "785fc2",
}
]
});
</script>
</body>
</html>
答案 0 :(得分:2)
试试这个
它将删除.php扩展名。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
使用
之类的链接<a href="contact">contact</a>
在Url中,它会显示为
domain.com/contact
答案 1 :(得分:1)
试试此代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/$ index.php [L]
ErrorDocument 404 http://www.akshadainfosystem.com
RewriteRule ^([^\.]+)$ $1.php [NC,L]
http://www.akshadainfosystem.com/profile原始网址http://www.akshadainfosystem.com/profile.php只是不像我一样在链接中添加.php扩展名。