.htaccess重定向/联系到root public_html文件夹中的contact.png

时间:2014-01-05 10:39:57

标签: php apache .htaccess mod-rewrite

这是我的.htaccess文件,位于public_html文件夹的根目录中:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?codeliger\.com$ [NC]
RewriteCond %{THE_REQUEST} \s/(index\.php)?[\s?] [NC]
RewriteRule ^ /home? [L,R]

RewriteRule ^home/?$ /index.php?page=home [L]
RewriteRule ^edit/?$ /index.php?page=edit [L]
RewriteRule ^education/?$ /index.php?page=home&filter=1 [L]
RewriteRule ^skills/?$ /index.php?page=home&filter=2 [L]
RewriteRule ^projects/?$ /index.php?page=home&filter=3 [L]
RewriteRule ^experience/?$ /index.php?page=home&filter=4 [L]
RewriteRule ^contact?/$ /index.php?page=contact [L]

这是我点击进入我的联系页面的链接:

<li><a href="http://codeliger.com/contact">Contact</a></li>

当我点击导航链接时,它会导航到:

http://codeliger.com/contact.png

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

这很可能是由于存在MultiViews option

.htaccess 顶部添加此行:

Options -MultiViews

答案 1 :(得分:0)

我认为问题在这里.. RewriteRule ^contact?/$ /index.php?page=contact [L]

                                        ^

更改此行

RewriteRule ^contact?/$ /index.php?page=contact [L]

RewriteRule ^contact/?$ /index.php?page=contact [L]