为什么我的localhost网站文件夹重定向到localhost

时间:2015-05-06 09:14:20

标签: apache .htaccess redirect xampp localhost

我在localhost xampp上设置了一个网站。

i.e. http://localhost/dance
but some of the pages redirected to http://localhost/page1.shtml
but i want them redirect to http://localhost/dance/page1.shtml

我的htaccess文件

#this url rewriting is to run on local server
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
#the above code is converting all .php extension to blank.

#for root category page
RewriteRule ^(.*)\.shtml$ root.php?roottitle=$1
#http://www.micsafrica.com/pagename.shtml


#for main category page
RewriteRule ^(.*)/(.*)\.shtml$ main.php?roottitle=$1&maintitle=$2

#for news page
RewriteRule ^news/(.+) news.php?news_id=$1 [nc]
#http://www.micsafrica.com/news/25


#for individual project page
RewriteRule ^project/(.+) project.php?project_id=$1 [nc]
#http://www.micsafrica.com/project/25

HTML链接

<a href="/page1.shtml"></a>
<a href="/page2.shtml"></a>
<a href="/page3.shtml"></a>

所以有必要在localhost htaccess中设置基本URL,如果是,请告诉我如何解决这个问题。

0 个答案:

没有答案